Mike Anderson wrote:
> Paolo Bonzini wrote:
>> If so, there is a good reason, and it is that class variables
>> are misused 99% of the time.  Class variables are *global* variables
>> visible to a hierarchy and, as such, they should be used as little as
>> possible.  When implementing a singleton, for example, what you *really*
>> want is a uniqueInstance class-instance variable.
> 
> Apparently the writers of our class library didn't understand this.

You mean GNU Smalltalk's class library?  Might be.  :-)

If the new syntax teaches us better practices, that can only do
well.

Regarding the singleton example, consider what happens if you have
a hierarchy of singletons and put the "uniqueInstance" class method
in the topmost class.  With class variables, it doesn't work.  With
class-instance variables, it does.

Paolo


_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to