From: matz@... (Yukihiro Matsumoto) Date: 2001-04-30T00:53:39+09:00 Subject: [ruby-talk:14409] Re: autoload Hi, In message "[ruby-talk:14396] autoload" on 01/04/29, Avi Bryant writes: |Why does autoload only work for toplevel constants? Because it's kinda hard to handle nested constants like "Foo::Bar" from C level. Unlike Perl, "Foo::Bar" is not a single package name. It retrieve the value of constant Foo, then the value of constant Bar defined within Foo (assuming Foo is a class or module). Constant "Foo" might not be a class nor module, might not be defined yet, etc. One alternative possibilitiy is moving autoload method from toplevel to modules, e.g: class Foo # load foo/bar when accessing Bar within Foo autoload "Bar", "foo/bar.rb" end matz.