From: dblack@... Date: 2006-03-09T00:58:01+09:00 Subject: Re: newbie question about scope, variables, declarations of variables and option strict (as in perl) Hi -- On Thu, 9 Mar 2006, James Edward Gray II wrote: > On Mar 8, 2006, at 9:38 AM, dblack@wobblini.net wrote: > >> Weird. I guess Logger does something bizarre in its constructor. > > I guess I don't understand what you are getting at. This is the normal > behavior for any object: > > Neo:~/Desktop$ ls > test.rb > Neo:~/Desktop$ cat test.rb > @obj = Object.new > p @obj.object_id > > def func > p @obj.object_id > end > > func > Neo:~/Desktop$ ruby test.rb > 957270 > 957270 For some reason I had hallucinated that the original example was inside a class definition body, rather than at the top level. Ignore me.... David -- David A. Black (dblack@wobblini.net) Ruby Power and Light, LLC (http://www.rubypowerandlight.com) "Ruby for Rails" chapters now available from Manning Early Access Program! http://www.manning.com/books/black