Throwing errors on mutating immutable bindings

Andreas Rossberg rossberg at google.com
Thu Oct 2 07:06:59 PDT 2014


On 2 October 2014 10:45, Mark Miller <erights at gmail.com> wrote:
> On Thu, Oct 2, 2014 at 12:22 AM, Andreas Rossberg <rossberg at google.com>
> wrote:
>>
>> On 1 October 2014 16:09, Erik Arvidsson <erik.arvidsson at gmail.com> wrote:
>> > The static error is problematic. I'm pretty sure that engines that do
>> > lazy
>> > parsing of functions is not going to report static errors before doing a
>> > full parse of the function.
>>
>> Well, it is no harder than reporting reference errors for unbound
>> variables in strict mode, which is already required for ES5.
>> ...However, at least V8 does not report that correctly either, as soon
>> as lazy parsing kicks in.
>
> Hi Andreas, can you show an example where v8 observably does the wrong thing
> here? Thanks.

No, I was confused, again. :) To set that straight:

- ES5 of course does _not_ require early errors for unbound variables.
- So the good news is that V8 is currently correct.
- The bad news is that requiring const assignments to be early errors
would indeed be a big new hurdle for lazy compilation.

And I now remember that I have brought this up myself at some meeting. :)

So, yes, please let us remove the requirement to make const
assignments an early error. A single, relatively unimportant
diagnostics like that is not worth the considerable complication for
VMs, especially given that all similar errors are not early errors
either.

/Andreas


More information about the es-discuss mailing list