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

Dean Landolt dean at deanlandolt.com
Thu Jan 12 11:02:41 PST 2012


/cc es-discuss (sorry Brendan -- you always seem to be the target of my
reply-all fails)

On Thu, Jan 12, 2012 at 2:01 PM, Dean Landolt <dean at deanlandolt.com> wrote:

>
>
> On Thu, Jan 12, 2012 at 1:21 PM, Brendan Eich <brendan at mozilla.com> wrote:
>
>> Sorry, are you seriously proposing that Node.js users when they specify
>> file permissions should manually write that out? Come on! Sorry, that's
>> just way too verbose and ugly.
>>
>
> They don't have to, an octal string mode works just fine:
>
>   fs.chmod(path, "0777")
>
> Octals can be little hazardous, and not just to noobs, but the hazard
> isn't with literals, it's with parseInt:
>
>   parseInt("022") // 18
>
> Better than losing octal literals would be to throw out the unary version
> of parseInt. Guessing the radix is crazy! I'm indifferent to whether octals
> stay the same or grow a o, but parseInt could really use some love!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120112/32cf7608/attachment.html>


More information about the es-discuss mailing list