Generics

Brian Brown rbb at techgame.net
Sun Sep 28 04:41:55 UTC 2003


On Saturday, Sep 27, 2003, at 18:05 America/Denver, Phil Hudson wrote:

> Are generic/template/parameterized/typesafe collections available in
> Smalltalk? I've had a look and can't see anything in the Squeak distro 
> or
> SqueakMap.

Certainly not in the 'strongly-typed language' sense of it. :-)

>
> Or am I just not "getting it"? Is it just not "thinking in Smalltalk" 
> to
> insist on a type?
>
>
>
Yes, this is probably true. Maybe try thinking in terms of Vocabulary. 
Since everything is a message sent to an  instance or class, then the 
idea of "compatiple types" is determined by whether the the receiver of 
the message understands the message. If class A understands all the 
messages sent to it by class B, then they can be used in an 
interchangeable way (in terms of message sends), and so can be thought 
of as the same type. Of course, you can add methods to classes at will, 
giving a class a larger and larger vocabulary, enabling it to be 'type 
compatible' with many other classes.

In summary, there is no type. Only messages. ;-)

(I'm a relative newbie to OOP in general and Smalltalk specifically, 
but this is the way my procedurally trained mind puts it into 
perspective)

I'm sure many of the other learned gentlemen on this list can explain 
things more satisfactorily!

Have fun!

Brian



More information about the Squeak-dev mailing list