Assigning to ReadOnly properties
brendan at mozilla.org
Mon Nov 12 17:29:42 PST 2007
On Nov 12, 2007, at 5:19 PM, Lars T Hansen wrote:
> IMO the only sane thing to do in this regard, if we were to do
> anything, is to add what we consider bug-fixing behavior to the
> effects of "use strict". We've already hung the eval change there,
For good reason too -- if eval can create bindings in its dynamic
scope, the type checker and even name sanity checks in strict mode
are a bit lost, aren't they?
> and though I don't remember right now if "with" has to be "reformed
> with" in strict mode I know we've talked about it (obviously this is a
> syntactic constraint only);
I asked whether strict mode should require "reformed with" here:
There may be a meeting note soon after that date, but wiki search
seems broken, especially at finding meeting notes. Do you want a
ticket on this?
> if everyone agrees that deleting an
> unknown property would be an error in a rational world, or that
> writing to a read-only property should be, then these are clear
> language bugs that don't need their own knobs. We need knobs, but too
> many knobs are if anything worse than none at all.
> We made a very special exception for eval wrt changing run-time
> semantics in strict mode for the code in the scope of the "use strict"
> pragma, and we've been careful to state that it's the exception that
> proves the rule: no run-time differences between strict and standard
> modes. The question about the bug fixes for delete and read-only
> properties is: are these errors so important and wide-spread that they
> warrant breaking that rule? The value of the rule is that "use
> strict" gives you verification only, after that you don't have to
> remember anything special (except for the change to eval); if we
> attach these bug fixes to the same rule, then (a) where do we stop and
> (b) is the language better, worse, or just different?
This is the slippery slope, indeed.
But first, let me check my understanding: 'use strict' must restrict
eval from creating bindings in its dynamic scope, or type checking is
defeated (eval could shadow an outer binding). Right?
More information about the Es4-discuss