Generics

Phil Hudson phil.hudson at iname.com
Fri Oct 3 15:43:53 UTC 2003


Hi Ingo,

This one technique:

>doesNotUnderstand: aMessage 
>
>	^ bag perform: (aMessage selector) withArguments: (aMessage arguments).

is a revelation to me. Old hat to most Smalltalkers I dare say, but to
me, that's powerful, that's elegant, that's cool. Try doing that in one
(readable) line in Java!

I do have a question though. Look what happens:

anIhoTypesafeBag isKindOf: Bag.  "answers false"

Now this is correct from the strict VM and class hierarchy point of view,
but false from the user's point of view. Did you consider overriding
#isKindOf: and decide against? If not, would it be right or wrong to write:

IhoTypesafeBag>>isKindOf: aClass
    ^ bag isKindOf: aClass

Would that break anything important that already exists? Please let me
know if I've misunderstood the semantics of #isKindOf: - I take it to be
cognate with Java's 'instanceOf' operator.

Regards,
Phil

>Hi Phil and others,
>
>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.
>
>this question just inspired me to try a typesafe wrapper around the bag 
>collection. (Example usage, and sort of a test, is in the class comment.)
>
>
>All comments are highly appreciated,
>
>Ingo
>




More information about the Squeak-dev mailing list