At 03:48 PM 6/8/2002 -0400, Dan Sugalski wrote: >At 3:35 PM -0400 6/8/02, Melvin Smith wrote: >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.
But scratchpads are still a tangible entity that has to be allocated and takes space to store variables. How are they better than a GC'd, random access stack object? -Melvin