From: "David A. Black" Date: 2007-11-11T02:24:55+09:00 Subject: Re: top-level methods and constants Hi -- On Sun, 11 Nov 2007, Xavier Noria wrote: > A couple of questions regarding the top-level environment of execution. > > * The Pickaxe says on page 376 that top-level methods are defined as private > instance methods of Object, whereas Ruby for Rails says on page 203 they are > private instance methods of the Kernel module. Which one is correct? The Pickaxe is right. I believe it got fixed in later printings of R4R, though. I can't remember what led to the original mistake -- I think I misinterpreted some method-list output I was getting while examining it all in irb, or something. > * Which is the actual container of a top-level constant? You may not want me to answer :-) But I do believe it's Object. ruby -ve "A=1; Object::A; Kernel::A" ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.10.1] -e:1: uninitialized constant Kernel::A (NameError) (plus a couple of void context warnings which don't matter) David -- Upcoming training by David A. Black/Ruby Power and Light, LLC: * Advancing With Rails, Berlin, Germany, November 19-22 * Intro to Rails, London, UK, December 3-6 (by Skills Matter) See http://www.rubypal.com for details!