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

Greg Smith greg at bocoup.com
Thu Jan 12 12:08:55 PST 2012


To me this seems like an exception rather than a common problem. Most APIs
/ tools don't use octals for this type of thing. Seems unnecessary to add
to the language for this one use case.

Not a Linux hater by any means, just the parseInt thing doesn't bother me
for this one situation. Or am I wrong and there are other common uses for
octal literals?

On Thu, Jan 12, 2012 at 2:51 PM, Wes Garland <wes at page.ca> wrote:

> I'll chime in with my vote - I would LOVE to be able to use octal literals
> again in GPSEE for setting file permissions.
>
> chmod("filename", parseInt("777", 8))
>
> ^^^^ just looks stupid when  chmod("filename", 0777) would work just fine.
>
> Wes
>
>
>
> On 12 January 2012 14:11, Brendan Eich <brendan at mozilla.com> wrote:
>
>> [Resending reply with elaboration. /be]
>>
>> Yes, the ability to quote the octal literal with Node's APIs came up on
>> the gist, but it's not enough.
>>
>> Quoting is easy to forget, and making the runtime convert string
>> (literal) to number is inefficient compared to having JS do it at
>> compile-time, and making the runtime (even via a call to parseInt) do it
>> also increases bug habitat ever so slightly.
>>
>> Mainly, users don't have to shun octal in non-strict mode, and they do
>> not in Node code I have seen. They won't be adopting strict mode as far as
>> I can tell. Banning octal is just one more reason for those who *might*
>> adopt strict mode to reject it.
>>
>> Agree on parseInt. Old dog, hard to change (runtime-only errors are
>> migration- and user-hostile). Not sure what to do there.
>>
>>
>> /be
>>
>> ______________________________**_________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>>
>
>
>
> --
> Wesley W. Garland
> Director, Product Development
> PageMail, Inc.
> +1 613 542 2787 x 102
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120112/eaca6d71/attachment.html>


More information about the es-discuss mailing list