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

Thaddee Tyl thaddee.tyl at gmail.com
Thu Jan 12 13:04:58 PST 2012


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.


More information about the es-discuss mailing list