From: gwtmp01@... Date: 2006-03-09T00:56:54+09:00 Subject: Re: newbie question about scope, variables, declarations of variables and option strict (as in perl) On Mar 8, 2006, at 10:38 AM, dblack@wobblini.net wrote: > > Weird. I guess Logger does something bizarre in its constructor. At the top level 'self' references the same object in the file scope and in the method scope (really private instance methods of the top- level object). Why then is it puzzling that the instance variables are accessible from either place? @a = 'this is @a' puts "top: self: #{self.object_id}" puts "top: @a: #{@a}" def foo puts "foo: self: #{self.object_id}" puts "foo: @a: #{@a}" end foo put that code in a file and run it: top: self: 1019060 top: @a: this is @a foo: self: 1019060 foo: @a: this is @a Gary Wright