From: Jim Freeze Date: 2002-11-22T00:29:55+09:00 Subject: Re: [FAQ] Interpreted vs compiled [FAQ] defining methods anywhere On Thursday, 21 November 2002 at 23:11:35 +0900, ts wrote: > >>>>> "J" == Jim Freeze writes: > > J> class Fred > J> def fred > J> puts "1" > J> end > J> fred # undefined local variable or method `fred' for Fred:Class > > pigeon% ruby -e 'p self, self.class' > main > Object > pigeon% > > In the class you have > > pigeon% ruby -e 'class Fred; p self, self.class; end' > Fred > Class > pigeon% > > So, class Fred def fred; puts "1"; end fred end is different than def fred; puts "1"; end fred because self=main and not a class? 'main' doesn't seem to be anything I can access directly. I guess this goes back to my original assumption, the top level is a special case. No? -- Jim Freeze ---------- It's a very *__UN*lucky week in which to be took dead. -- Churchy La Femme