Design Patterns and Collection Classes

David Griswold David.Griswold at acm.org
Mon Sep 2 20:04:07 UTC 2002


Brian Rice and all:

As Brian asked, I have attached the extracted sources for the core
classes in the Strongtalk collection hierarchy.  I have filtered out
subclasses that are not part of the core hierarchy.

It differs from standard hierarchies in two things: 1) it is
type-annotated and typechecked 2) it incorporates Cook's collection
hierarchy improvements.  The Blue-Book classes are there and have the
same names, however the hierarchy is shaped differently, because of the
above two changes, and so the abstract superclasses differ
significantly.

The biggest consequence of the above two differences is that unlike
other collection hierarchies, it is truly subtype-compatible.  This
means two things: 1) the classes and interfaces form a true subtype
hierarchy as far as the type annotations go, and 2) in addition they are
much more *semantically* substitutable.  The single biggest change that
most programmers will notice as a consequence is that #include: messages
should be used instead of #add: messages (include is like just like add,
except that it only adds the element if the element is not already in
the collection).  This lets you do things that you can't do in other
Smalltalks, like use OrderedCollections as Sets (since
OrderedCollections implement the full Set semantics, which is not true
because of #add: behavior in other Smalltalks).

If you want to read this, you will need to get used to reading
Strongtalk file-out format, which is similar to other ones except that
the reflective messages (class constructors etc.) use the Strongtalk
mirror interface.  Note: you will see the global Delta mentioned a lot
in the constructors; that was just the code name for the project, and
probably would have become Strongtalk or somesuch if it had reached
production.  You will also need to understand mixins, since they are
used heavily in the Collection hierarchy.  If you have any questions,
let me know.

Cheers,
Dave

Brian T Rice <water at tunes.org> wrote:
>
> Hi David,
>
> Would someone be kind enough to produce ascii-text (or at least
> non-binary) versions of the Strongtalk sources, since I don't have a
> readily-handy new Windows machine, and the Strongtalk system
> is totally
> unusable on older Windows versions? (I gave up after the
> hundredth blue
> screen.)
>
> I'm working on a new language, and want to incorporate the
> best ideas that
> I can into my collection hierarchy. I've already ported and augmented,
> trimmed, and modified Squeak's collection types, but without
> real access
> to Strongtalk, there are some aspects of this that aren't apparent.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: collections.zip
Type: application/x-zip-compressed
Size: 55836 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020902/1dd94708/collections.bin


More information about the Squeak-dev mailing list