Throwing errors on mutating immutable bindings
allen at wirfs-brock.com
Wed Oct 1 10:34:11 PDT 2014
On Oct 1, 2014, at 10:30 AM, Mark Miller wrote:
> On Wed, Oct 1, 2014 at 9:15 AM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> On Oct 1, 2014, at 9:05 AM, Mark S. Miller wrote:
>> Good point. If we can require all such assignments to be rejected statically, why is a runtime assignment to a const variable even possible? Can't we just assert that this cannot occur?
> The runtime cases I meant are the ones you mentioned. Sloppy with or eval dynamically shadowing a sloppy a [[Set]] reference to a const binding. Can't be a early error, should be a runtime error.
> Although it is a bit late to suggest it ;) ...
> Couldn't we have "with" and sloppy direct eval ignore/skip const and let bindings? Then these errors could always be early.
Actually we've already agreed that eval puts const/let/class bindings into a separate lexical scope. But, an eval can still var shadow an outer const declaration.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss