Throwing errors on mutating immutable bindings

Andreas Rossberg rossberg at google.com
Thu Oct 2 08:31:15 PDT 2014


On 2 October 2014 17:17, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> I believe that the module champions have always wanted static unresolvablse reference rejection to be part of the module semantics.  But we've never had actual specification for that semantics.

Yes, I had always hoped for a "stricter mode" applied to modules. But
I don't think that's something that's still possible at this (or a
later) point. If it had been, then it would have made total sense for
it to check against const assignments as well, along with a number of
other things.

> Personally, I think it would be fine for all of these sort of conditions to be specified as runtime errors and leave it to linters to find them early and JS implementations to optimize the runtime checks away.

Outside modules, with the language being as it is, adding one minor
new static check definitely does not seem worth the trouble and the
cost risk.

/Andreas


More information about the es-discuss mailing list