Dan Sugalski wrote:
> What we're 
> doing is assuming we don't know and letting the variables decide 
> whether they'll care. Perl's will, though other languages can decide 
> differently.

Letting the variables decide?
So, we take a poll of all the arguments, and ask each one
which they think ought to be the receiver?
That would be O(n^2) in the number of args.

And what if (as for other languages) the variables don't care?
Then do we do left-side-wins?


> > maybe a
> > kind of "paper-scissors-rock" rulebase that orders types.
> > (What C/C++ hard-codes as "type promotion".)
> 
> Type promotion makes me more nervous than multimethod dispatch.
> I think I'd rather not do that unless we really have to.

But I'm not talking about actually doing type promotion; it's
just a scheme to decide who gets to decide.
In the example of int-vs-float, the rulebase (it's really just
a DAG) decides that float wins.  So a float.method gets an int
argument; the int isn't promoted to a float.


> > If no match is found in the rulebase for the 2 (n?) types
> > involved, then we could fall back to left-side-wins.
> 
> If we can't find a match, or if there are two equal-distance matches 
> with no clear winner, we throw an exception.

You don't like the idea of falling back to left-side-wins?


> > Btw, I think the "distance in type space" idea is pretty kewl...
> > but the thought of actually using it in parrot gives me thewillies.

What bothers me is this: the programmer needs to be able to predict
what the machine is going to do with the code she gives it.
And predicting how the machine is going to resolve the multimethod
call could be, in any but trivial cases, far too difficult.
Programmers will end up guessing -- or, even worse, not giving it
a single thought -- and then we may as well be programming in PL/1.
:-)


> Heh. I never expected to have to dust off my trig skills when I 
> started this. If I need to dig out the calculus books, I think I'll 
> just go run screaming...

Not to worry.  There's no trig involved.  Just the
Pythagorean theorem.

-- 
John Douglas Porter


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

Reply via email to