From: Paul Brannan Date: 2002-01-16T00:07:50+09:00 Subject: Re: A possible class variable bug? - Re: a wishlist for ruby 2.0 On Tue, Jan 15, 2002 at 12:30:27PM +0900, Chr. Rippel wrote: > Well following this logic it might make sense to (re)unfiy the concepts > of class variables and global variables the ladder being class variables > of the class Object. A somewhat radical version would be the removal of > class variables all together since it's possible to simulate the effect of > class variables using only class instance variables and class accessory > methods (since this has a "pythonish" touch to it surely won't fly;-) > In cvs you get ... I don't think this is safe. 1) It opens up access to the class's instance variables to the entire world; class variables are available only to the class and its descendants. 2) What happens when I define an accessor to instance variables in both the derived class and the base class? If Bar is a subclass of Foo, and foo is the accessor to class variable, then I have the option of calling (from an instance method): Foo.foo Bar.foo self.type.foo Generally, a class should not have to know its name, but if I call self.type.foo, then I get a different class variable depending on whether I instantiated a Foo or a Bar. Paul