-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello List, I'm trying to understand the way Ruby resolves symbol names and how the require statement fits in. I'll start right away with an example, which comes in two files (note the comments): - ---%<--- # a.rb: require 'a/b' module Foo class Foo::A def do_something() b = Foo::A::B.new b.say end end # a/b.rb: require 'a' module Foo class Foo::A::B < Foo::A def say puts "Hello, World" end end end - --->%--- With the above code, I get a "missing symbol" error. Placing the "require 'a/b'" statement within the Foo::A class remedies it. Now I'm not quite sure why. I know that require() is a statement like puts in regards of its execution time, i.e. there's no special treatment in some parse/compile/whatever phase before the actual execution begins. As such, it seems logic that I get the missing symbol error with the original code: Foo::A is not defined when the derivation is made, and as such, putting require 'a/b' some lines later helps. Am I correct with this explanation? Is there any best practice regarding such a situation? While this example is constructed, I'm trying to create a namespace hierarchy in which a class on top mediates several others that live further below the hiearchy, but don't derive from it. I'm open for all kinds of suggestions. Thanks alot in advance! Eric -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkwWzmkACgkQhS0drJ3goJJSTwCfZ8mJghOxUeiAyApkQFo7PoBA aT0An0GGVaN2aUIHJo8eMrmra7jS/xsy =uQ4K -----END PGP SIGNATURE-----