From: Gawnsoft Date: 2003-08-21T23:33:46+09:00 Subject: Re: Class variables - a surprising result On Thu, 21 Aug 2003 19:02:43 +0900, David Heinemeier Hansson wrote (more or less): >> Class variable allocation is per class scope, not per subclass scope. >> Sub1, Sub2 and Sup really do share their class variables. Now don't >> ask me for the "why exactly"... > >I was fooled by this as well. I don't know why I intuitively would >think that a subclass would get its own scope, but I did. Having your >own scope as a subclass would be a really neat addition, though. But >perhaps a reason from Matz would shed light? A class-instance variable is one in which the scope is specific to a given (sub)class. Am I correct in dimly recalling that Ruby has support for class-instance variables? Cheers, Euan Gawnsoft: http://www.gawnsoft.co.sr Symbian/Epoc wiki: http://html.dnsalias.net:1122 Smalltalk links (harvested from comp.lang.smalltalk) http://html.dnsalias.net/gawnsoft/smalltalk