Mark Reed wrote:
On 2005-07-12 12:22, "TSa (Thomas Sandlaß)" <[EMAIL PROTECTED]>
wrote:

I am also interested in the rationale behind the approach to manage MMD
my means of a metric instead of a partial order on the types.
Metric is a geometric concept which in my eyes doesn't fit type
theory.


The geometric interpretation does bring us into somewhat philosophical
territory. Not that that's anything new on this list. :)

Let me try a concrete example.  Suppose that class Answer has subclasses
Animal, Vegetable, and Mineral, with respective subclasses Dog, Potato, and
Diamond.  There are two methods named foo in scope, neither overriding the
other.  One is declared to take (Animal, Vegetable, Mineral), the other
(Dog, Potato, Answer).  Assuming the obvious memberships, which method
should foo(Snoopy, Mr_PotatoHead, HopeDiamond) call?  And more importantly,
why do you feel that is the right answer?
According to Damian's metric, we have distances of 0+0+2=2 and 1+1+1=3, so (Dog, Potato, Answer) is "closer" and would get called.

Uhh, both targets are applicable but none is more specific on all
positions. I would like this to be an "ambiguous dispatch" error.

Actually it's a pitty, that the multi method call syntax isn't as
rich as the single method call syntax where we have .?method, .+method
and .*method. Something like (Snoopy, Mr_PotatoHead, HopeDiamond).*foo
doesn't exist, right? Or is it foo.*(Snoopy, Mr_PotatoHead, HopeDiamond)?
--
TSa (Thomas Sandlaß)


Reply via email to