Arithmetic (was: Polymorphism without protocol dilution)

Travis Griggs tgriggs at keyww.com
Wed Aug 26 18:58:12 UTC 1998


Maurice Rabb wrote:

> At 10:34 AM 8/26/98, Travis Griggs wrote:
> >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.
>
> So beyond needing to create less methods in total, what if any is the real
> advantage over DD?

When I posed this question a couple o' months back, Dan Ingalls indicated that he
felt the #adaptToType: approach might be a little more tractible to a Squeak
newcomer. I don't really feel qualified to argue that point one way or the other,
since I've been talkin' Small for a while now. I will give that double dispatching,
at least for me, was a piece of the Smalltalk enlightenment puzzle. An #adaptToType:
type message is basically a polymorphic application of a type cast, something that
we're all familiar with from more arcane systems. OTOH, the only people that have
really delved into the core number stuff so far, have been people comfortable with
100% messaging. Ultimately, the whole thing would best be solved by adding
multi-methods to Squeak, but I'm not that good of a VM hacker. :)


> I was planning to use DD for the Rectangle arithmetic as well.  When I am
> done how about we unify this with STP's bug fixes?

Sounds great. I'll go ahead and move the numeric collection stuff in as well. I also
intend to have a go at adding strings to numbers and vice versa (aka Perl).


> >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.
>
> I got my 2.1 in st.cs.uiuc.edu  Smalltalk/Squeak/2.0/Squeak2.1sea.bin.
> I seem to remember that after downloading the archive I was surprised
> because it was name 2.0. Ignore this because inside it is actually 2.1.

Dang. I should've let it finish downloading. I saw the name and slapped the cancel
button.

--
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