Throwing errors on mutating immutable bindings

Shu-yu Guo shu at
Tue Sep 30 17:09:11 PDT 2014

Hi all,

In the current draft, I see 2 different places where assigning to an immutable binding ('const') throws an error:

1) Dynamically throwing a TypeError in SetMutableBinding,
2) Statically throwing a Syntax Error in assignment expressions,

1) throws only in strict mode code, while 2) throws regardless. 2) is also best effort; seems to be implementation-dependent what "can statically determine" entails.

Is the intention that assigning to consts silently nops if the implementation cannot determine the assignment to be to a const statically, in non-strict code, but implementations *should* make a best effort to report such cases eagerly, regardless of strictness? Seems kind of odd to me; perhaps I am misreading?


More information about the es-discuss mailing list