Thanks for the response.

On Tue, 2002-07-23 at 13:23, Melvin Smith wrote:
[reordered]

> If you want to take a whack at it before I get to it, take a look at the
> global variable ops, although they aren't perfect. I just stacked them
> on top of the Hash PMC that we already had.

If you think you won't get to it for a while then I would be happy to
give it a stab.

> I started on a simple implementation. I decided to just use the
> PerlHash that we already have.
> 
> I planned to add a new stack for lexical scopes, making it COW,
> and the newpad op would simply create a new Hash PMC and push
> it onto that stack, and vice-versa.

[...]

> The fun part after you get the skeleton working is copying the
> pads on write for closures, etc.

Do you think a linked list approach (like 'struct Stash' for globals)
where each scope has a link to it's parent scope would be both simpler
and sufficient?

We could give the Parrot_Context struct a pointer to the current scope,
and inside of the invoke method of the Closure (Sub?) PMC I think we
would just need to set the interpreter's pointer to the correct scope,
something like:

  interpreter->ctx.current_scope = SELF->scope;

What do you think? Is there something I am misunderstanding about how
closures work?

> On this line, we need to discuss the symbol table format for
> the bytecode. I played around a bit but nothing I wish to commit.

I haven't given this any thought yet ...

--
Jonathan Sillito

Reply via email to