[Python-ideas] Democratic multiple dispatch doomed to fail (probably)
Stephen J. Turnbull
stephen at xemacs.org
Sat Dec 15 23:08:43 CET 2007
ntoronto at cs.byu.edu writes:
> This is almost precisely the Borda protocol:
>
> http://en.wikipedia.org/wiki/Borda_count
No, it is not. The Borda rule requires a linear order, whereas this
is a partial order, and complete indifference is possible.
> Why? The agents are voting a kind of utility, not a preference. With the
> addition or removal of a function, the sum of votes for any other function
> will not change.
And this utilitarian rule has its own big problems.
For one, you could argue that it violates the Arrow condition of
non-dictatorship because *somebody* has to choose the weights. In
particular, weighting the number of levels by one doesn't make a lot
of sense: some developers prefer a shallow style with an abstract
class and a lot of concrete derivatives, others prefer a hierarchy of
abstract classes with several levels before arriving at the concrete
implementations. I think it would be a bad thing if devotees of the
latter style were discouraged because their users found the
convenience of automatic dispatch more important than the (usually
invisible) internal type hierarchy.
Also, my intuition doesn't rule out the possibility that self *should*
be a dictator if it "expresses a preference" -- the Arrow condition of
non-dictatorship might not even be appropriate.
> I imagine that making next-method calls behave is a nightmare, though. The
> more I read about multiple dispatch, the less I like it.
It's a hard problem.
More information about the Python-ideas
mailing list