Andreas Rossberg (2013-08-22T09:59:58.000Z)
domenic at domenicdenicola.com (2013-08-25T01:01:47.696Z)
On 21 August 2013 16:02, Erik Arvidsson <erik.arvidsson at gmail.com> wrote: > Here is a proof of concept using Proxy (Spidermonkey only) > > http://jsbin.com/AWIs/2/edit > > It rewrites the `with (expr)` with `with (createUnscopeable(expr))` > where createUnscopeable returns a proxy that filters out the black > listed property names. A small nitpick: that implementation doesn't quite work, because it does not delegate other operations correctly. The wrapping proxy will leak into the object as receiver. Consider: ```js var o = { __unscopeable__: ['a'], a: 1, f: function() { return 'a' in this } } with (createUnscopeable(o)) { f() // false! } ``` A proper implementation would require explicit delegation for all receiver-aware traps. Left as an exercise. :)