Dan Sugalski <[EMAIL PROTECTED]> writes:
> Working on this. If everyone wants to hash out the sort of semantics
> they're thinking about, we can probably get to closure reasonably fast
> and get things designed and implemented quickly.
My scheme implementation is a working (a little bit hacky but
working) implementation of closures.
The following things are definitly needed:
* get_current_lexical_scope or peek_pad
* set_current_lexical_scope or push_pad/pop_pad
The following can be vtable operations on a Scratchpad PMC or
dedicated ops working on the current Scratchpad.
* clone
* increase of size (at least by 1)
* get keyed with STRING
* set keyed with STRING (for changing an already existing binding)
* set keyed with -1;STRING (for new definitions)
These to are needed to do lexical addressing
* get keyed with INTVAL;INTVAL
* set keyed with INTVAL;INTVAL
These may be nice but not needed for scheme
* get keyed with INTVAL (getting direct to the Hashes)
* set keyed with INTVAL;STRING
* new (create an empty Pad, sometimes at startup parrot must do
this)
* decrease of size
The Sub.pmc may do the following things (but it shouldn't be the only
way to do this)
- get the current scope at creation time and save it
- push the current scope and make the saved on current at invoke
time
- pop the current pad before return
hope that helps
b.
--
Juergen Boemmels [EMAIL PROTECTED]
Fachbereich Physik Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F 23 F6 C7 2F 85 93 DD 47