On 21 August 2013 16:02, Erik Arvidsson <erik.arvids...@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: 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. :) /Andreas _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss