At 3:35 PM -0400 6/8/02, Melvin Smith wrote:
>At 08:30 PM 6/8/2002 +0200, Jerome Vouillon wrote:
>>On Fri, Jun 07, 2002 at 07:40:14PM -0400, Melvin Smith wrote:
>>>  The support isn't complete, for example, co-routines, etc. need to
>>>  swap in their own context, which right now they don't do.
>>
>>Instead of using some space on the stack, co-routines can store all
>>their local variables into their closure.  Then, there is no need to
>>swap in any context.
>
>At more risk of admitting more of my ignorance...
>
>We have to store the closure's variables somewhere, if not on a stack, where?

In scratchpads. The way perl 5 does it is that every subroutine has a 
scratchpad, and all the variables declared in that subroutine are in 
the scratchpad. (The parser plays some games with scratchpad access 
when there are multiple variables with the same name in a sub, but in 
different blocks) Makes closures a lot easier, since you don't have 
to play games with stack copying or anything.
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                       teddy bears get drunk

Reply via email to