[#1094] Re: [ruby-cvs] ruby, ruby/lib: * eval.c (ev_const_defined, ev_const_get), variable.c — Dave Thomas <dave@...>

> * eval.c (rb_mod_autoload, rb_mod_autoload_p): new method;

12 messages 2003/05/29
[#1095] Re: [ruby-cvs] ruby, ruby/lib: * eval.c (ev_const_defined, ev_const_get), variable.c — nobu.nokada@... 2003/05/29

Hi,

Re: [ruby-cvs] ruby, ruby/lib: * eval.c (ev_const_defined, ev_const_get), variable.c

From: matz@... (Yukihiro Matsumoto)
Date: 2003-05-30 12:36:20 UTC
List: ruby-core #1102
Hi,

In message "Re: [ruby-cvs] ruby, ruby/lib: * eval.c (ev_const_defined, ev_const_get), variable.c"
    on 03/05/30, nobu.nokada@softhome.net <nobu.nokada@softhome.net> writes:

|>    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.

							matz.

In This Thread