const x = 1; print("hello world"); x = 3; Should the output "hello world" be seen or not? Right now, nashorn treats this as "early error". But, see this: https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-11/nov-18.md#43-assignment-to-a-const-static-error http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts Has these lines / Assigning to a const declared binding throw, even in non-strict mode code. Eliminated requirement to statically find and report assign to const declared names./ under section "December 6, 2014 Draft Rev 29" So, it appears that the (as of now!) const re-assignment is reported as TypeError - but not an early error.
|