On 7/17/05, Damian Conway <[EMAIL PROTECTED]> wrote:
> "You keep using that word. I do not think
> it means what you think it means"
> -- Inigo Montoya
Quite. I abused Liskov's name greatly here. Sorry about that.
Anyway, my argument is founded on another principle -- I suppose it
would be Palmer's zero-effect principle, that states:
"In absence of other information, a derived class behaves just
like its parent."
I can argue that one into the ground, but it is a postulate and
doesn't fall out of anything deeper (in my thinking paradigm, I
suppose). My best argument is that, how can you expect to add to
something's behavior if it changes before you start?
Every SMD system that I can think of obeys this principle (if you
ignore constructors for languages like Java and C++).
And as I showed below, the Manhattan metric for MMD dispatch is
outside the realm of OO systems that obey this principle. In fact,
I'm pretty sure (I haven't proved it) that any MMD system that relies
on "number of derivations" as its metric will break this principle.
> All of which really just goes to show that the standard LSP is
> simply not a concept that is applicable to multiple dispatch. LSP is a
> set of constraints on subtype relationships within a single hierarchy.
> But multiple dispatch is not an interaction mediated by a single-hierarchy
> subtyping relationship; it's an interaction *between* two or more hierarchies.
I agree, now.
> > As a matter of taste, classes that don't do
> > anything shouldn't do anything! But here they do.
> But your classes *do* do something that makes them do something. They
> change the degree of generalization of the leaf classes under an L
> metric. Since they do that, it makes perfect sense that they also change
> the resulting behaviour under an L metric. If the resulting behaviour
> didn't change then the L *semantics* would be broken.
Yep. And I'm saying that L is stupid. In fact, (as I believe
you've already picked up on), I'm not picking on the Manhattan
combinator in particular, but using a derivation metric at all!
In another message, you wrote:
> In MMD you have an argument of a given type and you're trying to find the most
> specifically compatible parameter. That means you only ever look upwards in a
> hierarchy. If your argument is of type D, then you can unequivocally say that
> C is more compatible than A (because they share more common components), and
> you can also say that B is not compatible at all. The relative derivation
> distances of B and D *never* matter since they can never be in competition,
> when viewed from the perspective of a particular argument.
> What we're really talking about here is how do we *combine* the compatibility
> measures of two or more arguments to determine the best overall fit. Pure
> Ordering does it in a "take my bat and go home" manner, Manhattan distance
> does it by weighing all arguments equally.
For some definition of "equal". In the message that this was
responding to (which I don't think is terribly important to quote) I
was referring to the absurdity of "number of derivations" as a metric.
Picture a mathematician's internal monologue:
Well, B is a subset of A, C is a subset of A, and D is a subset of
C. Clearly, D has fewer elements than B.
This mathematician is obviously insane. Then I think about the way
you're using numbers to describe this, and I picture his friend
responding to his thoughts (his friend is telepathic) with:
You can make a stronger statement than that: The difference of the
number of elements between A and D is exactly twice the difference of
elements between A and B.
And now maybe you see why I am so disgusted by this metric. You see,
I'm thinking of a class simply as the set of all of its possible
instances. And then when you refer to L on the number of
derivations, I put it into set-subset terms, and mathematics explodes.
Here's how you can satisfy me: argue that Palmer's zero-effect
principle is irrelevant, and explain either how Manhattan dispatch
makes any sense in a class-is-a-set world view, or why that world view
itself doesn't make sense.
Or just don't satisfy me.