help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Re: [RFC] Smalltalk scripting syntax


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Re: [RFC] Smalltalk scripting syntax
Date: Thu, 15 Mar 2007 22:06:52 +0100
User-agent: Thunderbird 1.5.0.10 (Macintosh/20070221)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]