Mike Klein mike at
Tue Mar 3 19:49:24 UTC 1998

Craig Latta wrote:

	I do think it's a mistake to think that classing is a required 
	"first principle" of object-orientation; it's just a implementation
	detail supporting method lookup that's been around for a long time.
	(The really important things for me are messages and autonomous
	computational units of state and behavior.)

I agree with this.  I wanted to point out a very common and annoying
problem with a lot of Smalltalk code.

Every object has a "hidden" instVar that points to it's class.
The mandates of OO say that we should consider this slot "private".
Yet Object implements the #class method to turn it into essentially
a public instance variable (fortunately read-only).
This seems to "encourage" code that makes decisions based upon the class
of an object.
(Just look at senders of class and isKindOf:, compared
to the less intrusive respondsTo:.  I'm not talking about tools such as
the debugger & inspector for which sending #class makes sense.)

-- Mike Klein

More information about the Squeak-dev mailing list