Jonathan Sillito wrote:
The patch looks pretty good to me. Here is a proposal for an alternative inheritance hierarchy. Invocable, the root of the hierarchy, is basically a sub that is not a closure (i.e. *no* context at all, just an address).
pmclass Invocable { # I called this sublite before /* SELF->data is always NULL */ /* SELF->cache.int_val holds address */
void set_integer_native(INTVAL value) { SELF->cache.int_val = value; } void* invoke() { return (void*)SELF->cache.int_value; }
... }
pmclass Sub extends Invocable { /* SELF->data is a lex_pad (or stack as Leo suggests) */ }
pmclass Continuation extends Invocable { /* SELF->data is a pointer to a Parrot_Context struct */ }
pmclass Coroutine extends Continuation {...} /* maybe ??? */
Might I suggest:
Sub as the base class Closure for what you call Sub Continuation and Coroutine as the same.
These names seem to hold closer to what they are strictly speaking.
Matt