lexical for-in/for-of loose end

Herby Vojčík herby at mailbox.sk
Tue Feb 7 02:44:36 PST 2012

Allen Wirfs-Brock wrote:
> With "body-swap" it concerns me a bit that is an arbitrary and
> variable number of closures may need to be updated each iteration
> (consider a body containing a while loop that spits out closures that
> capture init bindings.)

I think there are some lazy possibilities for that. Create the "copy" 
beforehand by sort-of Object.create(loopContext) then either use the 
"transparent proxy to loopContext while running / iterEnd: populate copy 
with let-vars / proxy become: copy" (pity there probably is not #become: 
(or #forwardBecome:) in vm) or "store copy to @wouldBeCopy in 
loopContext / closure-created: store copy to [[ContextForDetachment]] in 
closure / use actual record (loop-context) since 
actual-record-to-use. at wouldBeCopy === [[ContextForDetachment]] / 
iterEnd: populate copy with let-vars && loopContext. at wouldBeCopy = null 
(later different object in subsequent iterations) / in detached closure, 
lazily do actual-context-to-use = [[ContextForDetachment]] since 
actual-record-to-use. at wouldBeCopy exists and is different from 

Implementors can probably find better ones.

> Allen


More information about the es-discuss mailing list