Design Patterns and Collection Classes

Helge Horch Helge.Horch at t-online.de
Thu Aug 29 13:06:45 UTC 2002


On 29.08.2002, Richard A. O'Keefe wrote:
>     "class instance creation methods"
>     key: k value: v
>	^self new pvtKey: k value: v
>
>Except that this won't work; practically the only time I ever really
>need 'pvt' methods is so that a class can initialise a new instance
>without the initialisation method being exposed to another class, but
>the 'pvt' machinery will not let you do this: "private messages may
>only be sent to self".  If only there were a category of private messages
>that a class could send to 'self new'.  So the method _really_ has to be
>called #privateKey:value: and we just have to _hope_ that no outsider
>will use it.  So much for private methods.

But we can make it allow that!  It's just a small tweak in the 
Compiler, find my first hack at it attached.

This hack could be extended to also allow "super new" and "super 
new:", and maybe even check that it's compiling a class side method. 
I'll leave that open for discussion.

HTH,
Helge

P.S. Thanks, BTW, for mentioning

>Anyone read the paper about Smalltalk collections in OOPSLA 92?

I googled that you probably meant William R. Cook's "Interfaces and 
Specifications for the Smalltalk-80 Collection Classes", and CiteSeer 
was able to come up with a location on the web.  A *very* interesting 
read indeed.
-------------- next part --------------
Skipped content of type multipart/appledouble


More information about the Squeak-dev mailing list