From: Trans Date: 2005-07-31T01:26:02+09:00 Subject: Re: make local var visible Hmm... I just ran into a problem with constant lookup (namely class/module lookup). I wrote an autoloader, such that of #const_missing it will try to find the class or module in a file and require it. Unfortuately, for it to work I ALWAYS has to use '::' before the class/module name. I know what the problem and how to fix --I need to work upward through each namespace to see if it's there. But that got me thinking about what botp has asked. First I wondered what this could be meaningful: foo = [ "a","b","c" ] def mfoo ::foo.each do |f| p f end mfoo Then wondered too if variable lookup could proceed in a manner like constant lookup. If you don't find it in the current scope, then try the next one up, and so on. local -> instance -> class -> module namespaces -> ... -> top/global. (hmm..That's how block scopes seem to work too, now that I think of it.) I must be over looking something though, it seems too straight foward ;-) P.S. Matz, I would really like to know what you might have done if using case sensitivity for class/module names wasn't an option. I think that's a very interesting question. Thanks, T.