From: ts Date: 2002-05-11T20:56:09+09:00 Subject: Re: Class variable weirdness >>>>> "C" == Cristian Szegedy writes: C> My Ruby is: C> ruby 1.6.7 (2002-03-01) [i686-linux] Well, there is a bug in your version of linux :-))) pigeon% cat b.rb #!/usr/bin/ruby -v class A @@x = 1 def A.f puts @@x @@x = 2 puts @@x end end class << A def g puts @@x @@x = 3 puts @@x end end A.f A.g pigeon% pigeon% b.rb ruby 1.6.7 (2002-03-01) [i686-linux] ruby 1.6.7 (2002-03-01) [i686-linux] 1 2 2 3 pigeon% Now be carefull with this because this is modified with 1.7.x pigeon% ./ruby -v ~/b.rb ruby 1.7.2 (2002-05-10) [i686-linux] 1 2 /home/ts/b.rb:13: warning: class variable access from toplevel singleton method /home/ts/b.rb:13:in `g': uninitialized class variable @@x in Object (NameError) from /home/ts/b.rb:20 pigeon% Guy Decoux