logo       

Re: Design Patterns and Collection Classes: msg#01331

lang.smalltalk.squeak.general

Subject: Re: Design Patterns and Collection Classes

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.

Attachment: %LessPvt.1.cs.gz
Description: application/applefile

Attachment: LessPvt.1.cs.gz
Description: Binary data

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise