Transitioning to strict mode
Mark S. Miller
erights at google.com
Thu Feb 21 10:16:25 PST 2013
On Thu, Feb 21, 2013 at 9:12 AM, David Bruant <bruant.d at gmail.com> wrote:
> Le 18/02/2013 23:29, Claus Reinke a écrit :
>>>> What I'd like to understand is why likely static scoping problems
>> should lead to a runtime error, forcing the dependence on testing.
>> If they'd lead to compile time errors (for strict code), there'd be no
>> chance of missing them on the developer engine, independent of incomplete
>> test suite or ancient customer engines. Wouldn't that remove one of the
>> concerns against using strict mode? What am I missing?
> I guess it's too late now for ES5 strict mode.
> What was the rationale behind making it a runtime error?
> I think there were plans to make it a compile-time error... was it with
> the ES6 opt-in? :-s
> Can it be retrofit in new syntax which are their own opt-in (module,
For the ES5 semantics of the interaction of the global scope and the global
object, how could you make this a static error? What would you statically
test? Would you statically reject the following program, where
<someExpression> is itself just some valid expression computing a value
(that might be the string "foo")? Note that "this" below is the global
object, since it occurs at top level in a program.
this[<someExpression>] = 8;
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss