Re: Proxy questions

2013-01-21 Thread Kevin Smith
I want to stress this again: proxies, for all operations they can intercept, can always decide to go into an infinite loop or throw. If they do throw, they can't hide their attack from your code. In that sense they don't violate the code's integrity. The invariant enforcement mechanism is

Re: Proxy questions

2013-01-21 Thread Brendan Eich
Kevin Smith wrote: OK - but we can't have it both ways. We can't allow |this| to give us access to private data (regardless of the implementation) *and also* allow that |this| may be an untrusted proxy. If |this| grants access to private data, then it must be trustable. Anything else is

Proxy questions

2013-01-20 Thread David Bruant
Le 20/01/2013 16:49, Kevin Smith a écrit : Got it. And one more (thanks for bearing with me) I forked the thread. Go crazy if you have other questions :-) what affect does throwing an error have within a trap? You can think of it as an internal error, very much like Object.defineProperty

Re: Proxy questions

2013-01-20 Thread Kevin Smith
Does the stack unwind as with normal error handling? Does after bar get logged? (FF18 answers yes to the first and no to the second question.) I agree with FF18 here. OK. Consider this: class Purse { private balance; constructor() { balance = 0;

Re: Proxy questions

2013-01-20 Thread Mark S. Miller
Before commenting on the general question, I'm confused about something in your code. How did a proxy get bound to this in your example? On Sun, Jan 20, 2013 at 10:49 AM, Kevin Smith khs4...@gmail.com wrote: Does the stack unwind as with normal error handling? Does after bar get logged?

Re: Proxy questions

2013-01-20 Thread Kevin Smith
Let me correct a typo in that last one: var blackHolePurse = new Purse(); var blackHole = new Proxy(blackHolePurse, { get: function(obj, name) { if (name === somethingInocuous) throw new Error(Up in smoke!); return obj[name]; } }); try {