Proxy questions

Mark S. Miller erights at google.com
Sun Jan 20 11:11:09 PST 2013


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 <khs4473 at gmail.com> wrote:
>
>>> 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;
>         Object.freeze(this);
>     }
>
>     getBalance() { return balance; }
>
>     somethingInocuous() {}
>
>     deposit(amount, srcPurse) {
>         private(srcPurse).balance -= amount;
>         this.somethingInocuous();
>         balance += amount;
>     }
> }
>
> A proxy for a Purse instance could throw on access to "somethingInocuous",
> leaving the high-integrity object in an inconsistent state.  It would seem
> that a high-integrity object would need to assume that any access to a
> public property might throw, in case the object is being proxied.
>
> Am I thinking about this correctly?
>
> { Kevin }
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
    Cheers,
    --MarkM


More information about the es-discuss mailing list