Getting Started with Squeak

wirth at almaden.ibm.com wirth at almaden.ibm.com
Thu Oct 1 00:52:24 UTC 1998


<Very interesting anecdote from Dan Ingalls>:
I have to relate an anecdote from the early days.  We were using
Smalltalk-76, the first Smalltalk that performed well enough to support
serious software (it had the same engine as Smalltalk-80, and a simpler
body ;-).
There was a student (I can't remember who this was) on one of the Alto's in
the corridor who was having fun implementing a Fraction class (there wasn't
one built in).  He came over and asked me to give him some help because he
had gotten things in such a shape that something was preventing the screen
from redisplaying successfully when he proceeded from the debugger.
I went over and started to paw around, and discovered fairly soon that the
bottom-level call on BitBlt was recieving Fractions as parameters, and was
therefore failing.  As I looked around to see how that happened, I was
astounded to find that the entire browser in question had fractions in
practically every point and rectangle in all its views and subviews.  I
asked him about this, and he said, "I just reframed it, but maybe it was
because I made divide return a fraction."  I said, "Hmm, maybe so.  What do
you send to a Fraction to get the integer part?"  He told me.  I added the
coercion to BitBlt's fail code, and the whole thing proceeded to run just
fine when I restarted the method.  I remember feeling almost dizzy on the
way back to my office.
     - D

==================================

Dan says: "...the bottom-level call on BitBlt was recieving Fractions as
parameters, and was therefore failing."  And therein lies the value of
multi-methods (that dispatch on more than one argument, as in CLOS).  With
multi-methods I could define an "around" method for the BitBlt call,
without having to have any internal knowledge of BitBlt methods.

But that gets us onto the slippery slope where methods aren't even "owned"
by one class, but by the relationship between several (as defined in the
method signature), and the message passing paradigm doesn't even make sense
anymore.  So I'll stop before we get into another religious war :-)

Mike Wirth





More information about the Squeak-dev mailing list