From: William Djaja Tjokroaminata Date: 2002-10-12T01:17:04+09:00 Subject: Re: Different Behavior of Class Variables w.r.t ||= Hi, Can you elaborate more on what sort of bugs is likely to occur? (I.e., under what situation does "@@a ||= value" create a danger of creating the class variable at the wrong level?) And if it is a problem with class variables, why is it not a problem with instance variables? Regards, Bill ========================================================================= Kent Dahl wrote: > That might be a bad idea, since class variables are more "magical" than > both instance variables and local variables. > The inheritance hierarchy level where the class variable is first > defined decides where it is visible. This is not a problem with local > variables nor instance variables. Although it is alot more verbose, > using the "@@a = 1 unless defined? @@a" trick gives you the same > functionality, but is easier to spot while reading, if it causes a bug.