Skip to content

Instantly share code, notes, and snippets.

@jordansissel
Created June 26, 2013 22:54
Show Gist options
  • Save jordansissel/5872482 to your computer and use it in GitHub Desktop.
Save jordansissel/5872482 to your computer and use it in GitHub Desktop.
module Foo
class Error < StandardError; end
end
module Foo
class Baz
def initialize
puts Error
end
end
end
class Foo::Bar
def initialize
puts Error
end
end
# Works:
puts Foo::Baz.new
# Fails: uninitialized constant Foo::Bar::Error
puts Foo::Bar.new
@jbbarth
Copy link

jbbarth commented Jun 28, 2013

Sorry but that's not obvious, a lot of people think the second construct is a shortcut for the first. Including me-five-minutes-ago. Principle of least surprise anyone ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment