Assigning to ReadOnly properties

Mark Miller erights at gmail.com
Mon Nov 12 16:01:22 PST 2007


On Nov 12, 2007 2:30 PM, Brendan Eich <brendan at mozilla.org> wrote:
> Nothing as badly silent as assigning to a ReadOnly property, but here I'll
> bitch about a similar change during ES1 standardization: delete x => false
>
> Anyway, with exception handling these both seem like warts. At least with
> delete, the expression using that operator at the top level has a boolean
> result -- but the result could be true and the property is still "in" the
> object (via prototype-based delegation). Beware.

Another point of agreement! Caja attempts to be approximately a
"fail-stop subset" of ES3 (or ES3R), meaning (from the Caja spec):

# Caja is only a subset of JavaScript in a limited sense: While a Caja program
# has not explicitly indicated a failure, it executes within JavaScript's
# semantics. By \emph{indicate a failure}, we mean either throwing an exception
# or returning \code{undefined} for a property read.

To fix delete within this constraint, "delete <whatever>" in Caja
either return true or throws.

-- 
Text by me above is hereby placed in the public domain

    Cheers,
    --MarkM



More information about the Es4-discuss mailing list