On Tue, Nov 3, 2015 at 10:08 PM, Isiah Meadows <[email protected]> wrote: > Proxies can do a better, more thorough job of breaking encapsulation. > > ```js > var log = []; > String = new Proxy(String, { > construct(target, newTarget, args) { > log.push(args); > return Reflect.construct(target, newTarget, args); > } > }); > > (function () { > var s = String; > var private = function () { return new s("cat"); } > var public = function () { return private(); } > return public; > })() > ```
There's a possibility I am misunderstanding you but this is what I was trying to say is 'okay'. If you redefined String to be a proxy before the closure runs then that seems "legal". I disagree with Object.observe() because you can call it after the closure has run and see changes made in String (or another object for lack of a better example) when you call the exported function. ...but now I need to go read up on Reflect. Be back in a few mins when I have more slightly inaccurate things to say :o) _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

