From: nobu.nokada@... Date: 2003-05-30T22:24:12+09:00 Subject: Re: [ruby-cvs] ruby, ruby/lib: * eval.c (ev_const_defined, ev_const_get), variable.c Hi, At Fri, 30 May 2003 21:36:20 +0900, Yukihiro Matsumoto wrote: > |> x.rb: > |> XXX = 1 > |> > |> [~/tmp] ruby -ve 'module X; load "x.rb";end; p X::XXX' > |> ruby 1.8.0 (2003-05-29) [powerpc-darwin6.6] > |> 1 > |> > |> [~/tmp] ruby -ve 'module X; autoload :XXX, "x.rb";end; p X::XXX' > |> ruby 1.8.0 (2003-05-29) [powerpc-darwin6.6] > |> -e:1: uninitialized constant X::XXX (NameError) > | > |Thank you. Fixed now. > > I think autoload should require X::XXX to be defined, so that should > raise exception for this case, because X::XXX is referencing ::XXX > which can be seen via X. The confusion was caused by X::XXX as ::XXX > if there's no X::XXX. This has its own reason but still confusing. At first I thought so too. But, in this case, refereced is X::XXX which is exactly autoloaded one but not ::XXX. You might mean the case: autoload :XXX, "x.rb"; module X; p XXX; end so I agree that this XXX should not be autoloaded ideally. Or a confused is me? -- Nobu Nakada