Double dispatch

Gerardo Richarte gera at core-sdi.com
Wed Nov 4 19:39:00 UTC 1998



Travis explained:

> The original Squeak Math protocol does this. It works fine for the simple set
> of Integer, Fraction, Float, where one can basically define a heirarchy of
> supremacy.

    The original Squeak Math protocol is a good implementation of mathematical
definition for operators (find a superset containing both elements, closed for
the operation you what to perform). Is there an example where DD is needed (and
squeak's protocol doesn't make it).
    The only problem I found is that when you create a new class (such as
AlgebraicNumber) you need to add #adaptAlgebraicNumber: and
#adaptToAlgebraicNumber to every other class you what to interact with.
    DD is good for speed, but it's is not good when the operation is not
commutative, I think that a mixed solution (as usual) may be the better... Does
anybody has an idea on how to implement such a mixed solution? I mean DD and
#adapt* protocol.

    Protocolar Bye!
    Richie++





More information about the Squeak-dev mailing list