Octal literals have their uses (you Unix haters skip this one)

Oliver Hunt oliver at apple.com
Thu Jan 12 13:11:26 PST 2012

On Jan 12, 2012, at 1:04 PM, Thaddee Tyl wrote:

> On Thu, Jan 12, 2012 at 9:57 PM, Axel Rauschmayer <axel at rauschma.de> wrote:
>> If we were willing to add octal with a clear prefix I would be fine with
>> that, for consistency with hex, I'd lean towards 0o<...>, but I'm open to
>> any suggestions that people may wish to add.  Personally I'd also like a
>> binary form, a la 0b....
>> +1 to both. Then we have three kinds of non-decimal literals, for example:
>> 0b1011, 0o732 and 0xFFFF.
>> For long literals, Java has started to make "_" as a separator legal, that
>> would be nice to have, too:
>>      let aLotOfMoney = 120_327_756_228;
> +1 to that, too. It does make things easier to read. Ruby has had that
> for decades.
> It is a very specific use-case, but I feel like we shouldn't disregard
> non-generic use-cases. 0644 (used in node.js in a unix environment) is
> a non-generic use-case, and as such I feel it shouldn't just die. That
> is why I would like 0644 and 0o644 to co-exist.

Outside of strict mode 0644, etc will have to continue to exist as I believe both JSC and SpiderMonkey have existing content that depends on that octal notation working.  But it would be nice if we could standardise on nicely (unambiguously) prefixed notation that would also work in strict mode.


> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

More information about the es-discuss mailing list