From: John Mair Date: 2010-10-23T03:28:01+09:00 Subject: Re: Why is top-level an object rather than just Object? Robert Dober wrote in post #956378: > On Fri, Oct 22, 2010 at 5:07 PM, John Mair wrote: >> But, for most cases main already behaves like Object: >> >> * calling 'include' in main actually includes in Object > true, but I do not think it is a good idea >> * defining a method in main actually defines the method on Object > false; but as a private method, again I do not think it is a good idea >> * defining a constant in main actually defines the constant on Object > I buy this one >> >> The only notable exception, where 'main' acts like itself (that is - as >> an instance of Object) -- is instance variables. main has its own >> instance variables independent of Object. > finally a good idea ;) >> >> But i do not see a good reason not to just define the ivars on Object. > Oh but I do, why should Object have instance variables of the > toplevel, if there are some good metaprogramming reasons to define > ivars on Object ... disaster. Err, how exactly is it a disaster? can you explain? I can see no harm coming from it. If you can see harm - then explain exactly what harm you see rather than just communicating a vague sense of foreboding....hehe ;) John -- Posted via http://www.ruby-forum.com/.