From: ts Date: 2001-12-16T20:31:53+09:00 Subject: [ruby-talk:28669] Re: assigning to class variable works in string, not in block >>>>> "J" == Joel VanderWerf writes: J> Was the problem that @@base_class was not getting bound to the class J> variable of BaseClass, because it was referenced in a block whose scope J> was module M? For class variable (like for constant) you have 2 steps : declaration and assignement. Because @@base_class was seen in a singleton method, ruby think that it's an assignement. It's error message was to say that it can't find a *pre-declared* class variable @@base_class. With "class << self; def xxx() end; end", the class variable is seen in a method and for ruby it's a declaration. In this case the variable is created if it don't exist. Guy Decoux