From: Christoph Date: 2002-03-03T09:48:44+09:00 Subject: Re: class vars broken in 1.6.7 "Joel VanderWerf" wrote in .... > > ..and the following prints "0": > > class C > @@cv = 0 > class << self > def test > @@cv = 5 > p @@cv > end > end > > test > end Hm my previous response was probably a bit hasty - the current behavior clearly is a problem and ``meta-class'' variables don't seem to work either - I was hoping for something simple like ---- class C @@cv = 0 class << self @@cv = 5 def test @@cv = 5 end end def test; @@cv end end class D < C; end D.new.test # => 0 D.test # => 5 ---- To elaborate on your bug a little bit further - right now in the main branch we got ---- class Class # @@cv = 'test' end class C @@cv = 0 p @@cv class << self @@cv = 'bmeta' @@cv = 'meta' p @@cv class << self p @@cv @@cv = 'meta2' p @@cv end end end ---- 0 0 'meta' 'meta' ---- versus ---- class Class @@cv = 'test' end class C @@cv = 0 p @@cv class << self @@cv = 'bmeta' @@cv = 'meta' p @@cv class << self p @@cv @@cv = 'meta2' p @@cv end end end ---- 0 0 'meta' 'meta2' ---- which is all pretty weird ... /Christoph