On Jun 16, 2008, at 8:28 PM, Mike Samuel wrote:

> From my reading of ES4, the eval operator works that way, and the  
> eval function works like (new Function (textToEval))().  Is that  
> correct?

The latter (eval function, called indirectly, e.g.) is detectably  
different: var bindings at top level in the textToEval do not persist  
in the global object, but make local variables in the new Function.


> Is there no way to supply an environment to resolve free variables  
> in textToEval?

The usual way to do this is to wrap the eval call in a function whose  
arguments name the free variable, and return the result. The usual  
shared prototype and global mutation hazard warnings apply, but any  
var bindings in the program will be confined.

/be
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to