Proxy questions

Kevin Smith khs4473 at gmail.com
Sun Jan 20 10:49:11 PST 2013


> 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 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130120/e34188b4/attachment-0001.html>


More information about the es-discuss mailing list