Polymorphism without protocol dilution

Mike Klein mike at twinsun.com
Tue Sep 1 18:28:04 UTC 1998


> On 8/29/98 at 4:37 PM, alank at wdi.disney.com (Alan Kay) wrote:

[emphasis on readability]

> At 12:04 PM 8/30/98, Marcus Denker wrote:
> >From the Camel Book ("Programming Perl", by Larry Wall, Tom Christiansen &
> >Randal L. Schwartz) p.2.

[ironic quote about readability and perl] 
(ironic because I think most perl looks like line noise)

> At 12:16 PM 8/31/98, Mike Klein wrote:
> [munch many good points]

Thanks!

> Once a method name is used in an important protocol it is gone.  It is
> shame that so many names have been misused, and so many methods are
> misnamed.  That is why I am so obsessed with creating good names before
> they get locked in stone for posterity.
> 
> It reminds me very much of the misuse of the electro-magnetic spectrum.  It
> is a finite space that cannot be taken for granted.  I know that from time
> to time there is discussion of sub-namespaces.  However if I am correct,
> this discussion is surrounding the class name space, not the method name
> space.

Actually, I think that the message name space is far more important,
(and far more neglected).  Message sends are the soul of Smalltalk,
whereas, ideally, global (class) references should be kept to a minimum,

> In some sense, even more than in spoken languages, we need to use messaging
> words with precision.

I beleive we need to better distinguish when we have "loose" vs. "tight"
semantics.  For example, I am much more comfortable changeing a
printString method than a storeString method because printString has
looser semantics than storeString.

The below method was an attempt to have a "loose" method punt on the issue
of whether a parameter is passed as an object, or a valueProvider,
(or a valueProviderProvider  (can you say metablock :-) )

> >Object >> fullyEvaluated
> >
> >fullyEvaluated
> >        | result lastResult |
> >        result := self.
> >        [(lastResult := result) respondsTo: #value] whileTrue: [
> >                result := lastResult value.
> >                result = lastResult ifTrue: [^result]].
> >        ^result
> >
> >This is sort of like Mathematica's evaluation loop (without the Hold[])
> >  [0->[3]] fullyEvaluated   =>   3
> >
> >-- Mike Klein

> Considering this, like Mayor Quimby, I want to flip-flop.  I now like
> #evaluated better than #asEvaluated.  It seems that every instance of an
> 'as' method suggests some kind of copy is created.  I don't necessarily
> intend a copy, just an evaluated version of the object.

I believe that the Smalltalk culture uses #as{Type} when the intention
is a (mostly) information-preserving transformation of the receiver.

Your suggestions of #evaluated, while better than #value, still sounds
functional.  I think #evaluate sounds more imperitave.

> Ahhhh Mathematica!  Yet another way cool product from good ol' UI.

Yeah, but ever try to find a BNF for it?

> --Maurice

-- Mike Klein





More information about the Squeak-dev mailing list