On Tue, 29 Jul 2003, Leopold Toetsch wrote:

> Simon Glover <[EMAIL PROTECTED]> wrote:
> >   Try and explain what invoke is supposed to do. NB this still needs work
>
> [ snip ]
>
> >   +=item void* invoke(INTERP, PMC* self, void* next)
>
> [ snap ]
>
> >   +It should set up the environment for the sub, and should return the
> >   +location at which operation flow should continue after the subroutine
> >   +returns.
>
> The C<invoke> vtable method gets a bytecode address, that is the
> NEXT() in the opcode stream. But it returns the address, where it wants
> to jump to. Returning to the passed address is not up to the called
> subroutine object, setting up specific environment depends on the
> called subroutine object. A look at docs/pmc/subs.pod might provide some
> hints.
>
> So the invoke opcode branches to the address it got from the invoke
> vtable, normally: eval.pmc is slightly different or it takes just longer
> to branch really there ;-)
>
> Sorry if that was missleading in my first answer regarding that topic.

 I said the current draft needed work :-)

> Anyway, there are no really general rules what the vtables do. They are
> some kind of overloading (e.g. get_integer()):
>
>    set I0, P0 # get an integer from a scalar
>    set I1, P1 # get size of aggregate P1

 Yes, but in both cases we can still document the general intent of
 the method: it returns an integer value from the specified PMC.
 Now, what that value _actually represents_ is another matter, and you're
 right that PDD02 isn't the place to discuss that.

 I shall try and add something along these lines to the docs soon, but I
 don't have time tonight.

 Simon

Reply via email to