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

Alex Kocharin alex at kocharin.ru
Tue Aug 5 08:28:43 PDT 2014


05.08.2014, 19:07, "Mathias Bynens" <mathias at qiwi.be>:
> On 5 Aug 2014, at 16:56, Alex Kocharin <alex at kocharin.ru> wrote:
>>  What about allowing one-digit numbers with leading zeroes? "07" equals to 7 no matter whether it parsed as an octal or as a decimal. Thus, no harm there.
>
> That wouldn’t solve the problem. Consider e.g. `01234567` (i.e. `342391`) vs. `01234568` (which must equal `1234568` for compatibility with existing code).

This would solve the problem mentioned in the first message. `new Date(2013,08,12);` and `new Date(2013,07,12);` are harmless, since they always mean the same thing (even though first one is decimal and second one is octal).

`01234567` should still be deprecated and replaced with `0o1234567`, but I don't think it comes up as often as those single-digit ones.


More information about the es-discuss mailing list