Early error on '0' followed by '8' or '9' in numeric literals does not seem to be web-compatible

Mathias Bynens mathias at qiwi.be
Tue Aug 5 08:38:50 PDT 2014


On 5 Aug 2014, at 17:19, Mark S. Miller <erights at google.com> wrote:

> On Tue, Aug 5, 2014 at 8:17 AM, Mathias Bynens <mathias at qiwi.be> wrote:
> 
>> The literals under discussion (e.g. `08` and `09`) are not octal literals.
> 
> Strict mode should reject these even more vehemently! (Allen, can we have an early vehement error?)

Now I’m confused again. That contradicts what Allen said earlier in this thread:

On 5 Aug 2014, at 16:20, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:

> Regarding, leading 0 constants in strict mode. The long term plan is to eventually make them legal decimal constants.

I stand by my earlier suggestion:

1. Accept decimal integer literals with leading `0`, even in strict mode.
2. Interpret the value of such literals as octal in case they consist of octal digits only. (Note: this is already in Annex B – see `LegacyOctalIntegerLiteral`.)

Strict mode would accept `08` as it’s a zero-prefixed decimal literal but not `07` since that’s an octal literal.

This matches what all browsers already do (except Firefox), and fulfills the long-term plan Allen was talking about.


More information about the es-discuss mailing list