develooper Front page | perl.perl6.internals | Postings from July 2002

vtables and multimethod dispatch

Thread Next
Dan Sugalski
July 7, 2002 12:43
vtables and multimethod dispatch
Message ID:
Okay, now that the dust from YAPC has settled and the holidays and 
such are done, it's time to get to some of the outstanding bits of 
Parrot. I'm going to get the extension mechanism designed over the 
next few days, but until then...

We need a multimethod dispatch for vtable calls. Right now we're 
working on a "left side wins" scheme and, while we're going to keep 
that (sort of) we really need a way to choose the method to call 
based on the types on both sides of binary operators. (Unary 
operators, luckily, are easier)

Basically what we need is a lookup matrix for each vtable method 
(add, subtract, multiply, whatever) that we can index by left and 
right types to get the actual method to call. The current 
int/num/string/same scheme can stay, as they're multimethod already, 
and handy shortcuts. The methods that take a generic unknown PMC are 
the ones that need to do the multimethod lookup.

We can do this with the current vtable scheme as it is, since we 
already have a slot to put this in, and I think we're going to have 
languages that still do a left-side-win scheme.

Yes, this means we're going to have to do matricies (at least 2D 
matricies), class dependencies (so derived classes can inherit from 
parent classes so as not to leave gaps), and method registration at 
PMC load time.

I'd hoped to avoid this, but...

I'll get more details together in a bit.

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai                         have teddy bears and even
                                       teddy bears get drunk

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About