----------
From: sqrmax@cvtci.com.ar To: squeak@cs.uiuc.edu Subject: Re: Transcendental Numbers Date: Wednesday, January 28, 1998 9:26 PM
I also liked the DD that VS does. But after seeing the coercitive
approach,
I liked it more because it needed less methods. It has the drawback of intermediate objects. But this can be avoided almost all the time,
designing the
implementation in such a way that it keeps converted results only. Then,
you
convert when you start only, and work with a single kind of objects...
this
kind of objects will be the one that has greater coercitive power. For instance, I had the same problem when I designed polynomials, because I
wanted to add
numbers to polynomials and multiply them by objects like integers,
fractions
and so. With DD in VS, I just programmed polynomial * anything and that
was
it (but then I had to check all the time what was that anything). Now,
with
Squeak, I added the adapt and adaptTo methods and the conversion is done
only
once (and I don't have to check what argument I'm given, so I can
describe
the multiplication as polynomial * aPolynomial).
I think we're seeing this through a bit different eyes. It is not clear to me whether your mixed math with Polynomials was commutative. IOW, that not only could you perform:
polynomial + 4
but also that you could perform:
4 + polynomial
IMO, any mixed math you add to the system, should be communtative. VS, IMO, did not do a complete implementation of the DD stuff. At least as far as points goes. In 3.0.1, you could add a simple number to a point, but not a point to a number. I would argue in VS, that you hadn't done DD (not the way I understand it). To have implemented it the way I understood it, you would've done something like:
Polynomial>>+ aNumber ^aNumber sumFromPolynomial
Then, for any potential argument you would've implemented the sumFromPolynomial: message, *including in Polynomial itself*. That's the beauty of DD, is that there are NO isThisOrThat checks and subsequent branches. The traversal of messages ends up in the right place.
-- Travis Griggs Key Technology tgriggs@keyww.com GO SMALLTALK - AND BEYOND!
squeak-dev@lists.squeakfoundation.org