Throwing errors on mutating immutable bindings

Andreas Rossberg rossberg at google.com
Thu Oct 2 00:24:33 PDT 2014


On 1 October 2014 20:32, Jason Orendorff <jason.orendorff at gmail.com> wrote:
> I think there is a way that the error could occur at runtime even in
> all-strict-mode code: when a new const is added at toplevel in a
> second script.
>
>     <script>
>       "use strict";
>       function f(value) { x = value; }
>     </script>

That's an early ReferenceError right there, AFAICT, regardless of what
follows in a later script.

/Andreas

>     <script>
>       "use strict";
>       const x = 0;
>       f(1);
>     </script>
>
> -j


More information about the es-discuss mailing list