Polymorphism without protocol dilution

Travis Griggs tgriggs at keyww.com
Wed Aug 26 17:34:58 UTC 1998



Maurice Rabb wrote:

> >Scary to have your own quotes, long forgotten, dredged up out of the dust.
> >I feel
> >like Bill (Gates or Clinton, take your pick). What continues to gnaw at
> >brain is
> >what you sum up so well with the statement
> >
>
> I regret my inapropriate relationship with my Squeak archives. :-)
> Seriously, I didn't mean to use your quote as a kidney punch.  I just
> though your comments were so apropos.  The tough questions are definitely
> cyclical.  Unfortunately, the lousy ones (ala C++ vs Smalltalk) repeat as
> well.
>
> >For a while now, we've had a ?framework? in VisualWorks that I've thought about
> >porting over to Squeak and releasing, but I've always feared the flame about
> >diluting protocols. But tonight, I'm coming out. :)
>
> [munch]
>
> >blow my friends and teachers away. I would just whip up little expressions:
> >
> >#((1 2 3 4 5) + #(6 7 8 9 10) * 4) sum
> >
>
> Hmmm, that looks pretty cool and compelling to me.
>
> >Maybe the arithmetic protocol is one that dilutes better.
>
> This reminds me of the "is Point a Magnitude or not" discussion.
>
> Your comments have given me the courage to add the arithmetic protocols I
> really want to Rectangle.  BTW, is Squeak arithmetic now using some sort of
> hybrid between double dispatch and coercion?  What is the advantage?  It
> used to use straight coercion, right?  Travis are you still using your DD
> changeSet?

Yup. One might call what Squeak has a form of double-coercion. The generality scale
is built right into the various #adaptToType: messages. So that negates the use of
the older coercion scheme found as  fallback in VW. It also limits having to
reproduce the tree for each of the basic four arithmetic ops (+, -, /, *). OTOH, it
requires extra message sends to get some work done, and can create intermediate
objects.

Yes, I still use the DD changeSet. Note that Stephen Travis Pope found a bug or two
in the LargeInteger stuff, which he generously posted to the archive. I haven't done
any actual real work as of late, just poked around. I can't even figure out where to
download the 2.1 stuff for the Mac. The UIUC link downloads a 2.0 binhex file.

--
Travis Griggs
Key Technology
tgriggs at keyww.com
Smalltalk - 100% Pure Objects, Always had 'em, Always will!





More information about the Squeak-dev mailing list