Throwing errors on mutating immutable bindings

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Oct 1 10:00:46 PDT 2014


On Oct 1, 2014, at 9:43 AM, Oliver Hunt wrote:

> 
>> On Oct 1, 2014, at 9:05 AM, Mark S. Miller <erights at google.com> 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?
> 
> You mean duplicate assignment? IIRC the problem is code that does
> 
> const x;
syntax error: no initializer

> x=blah;
> 
> or 
> 
> if (foo)
>     const x = bar
syntax error: not a statement
> else
>     const x = wiffle
syntax error: not a statement
> 
> etc
> 

Allen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141001/848b4b68/attachment.html>


More information about the es-discuss mailing list