Sam Ruby <[EMAIL PROTECTED]> wrote: > Leopold Toetsch wrote: >> >> Not quite. It's just: >> >> f = getattribute Parrot_string, "find" >> >> nothing more. The C<get_attr_str> vtable has to do the right thing, i.e. >> if the attribute is a callable, it has to return a bound method object.
> Exactly. [ I've checked in the Bound_NCI PMC now ] The default implementation of get_attr_str already did a method lookup (it should probably use VTABLE_find_method, though). For the easy case - the method is NCI - now a Bound_NCI object is returned. Invoking that places the bound object as P2, which is fine for NCI calls, as the calling conventions are fully under our control. It's just a matter, how the signature "O" is translated: either take the next argument from P2 of from the next in P5, P6 ... So actually for NCI methods the current scheme is fine as shifting arguments isn't needed. Still remaining and unsolved is the problem with user methods argument passing, which does just not match. > C<set_pointer> sets the pointer to the actual subroutine. That's not quite right. C<set_pointer> set's the function address of a callable. Anyway, a "Bound_NCI isa NCI" - it's not a container object like your implementation is. This simplifies inheritance vastly. > ... C<set_pmc> > sets the pointer to the "bound" object. And we've additionally C<PMC* get_pmc()>, which returns the bound object. > - Sam Ruby leo