Pass an environment to eval()?

Axel Rauschmayer axel at rauschma.de
Sat Sep 28 14:49:14 PDT 2013


Has this feature ever been considered?

For example:

```
$ var env = { __proto__: window, foo: 1 };
$ eval('var bar = foo+1', env);
$ env.bar
2
```

Useful for writing interpreters and more convenient for interacting with evaluated code than improvising something equivalent via `Function`.

Axel

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130928/ef9c2afb/attachment.html>


More information about the es-discuss mailing list