parseInt and implicit octal constants

Herman Venter hermanv at microsoft.com
Fri Feb 20 12:21:47 PST 2009


I seem to recall that the brave (ie, risky) decisions to remove octal was taken over 11 years ago. Except for Opera, no-one has dared to implement the decision. That probably says something.

I also seem to recall that implementing octal in JScript .NET was far easier than updating all of the test cases that failed if I did not. ;-)

Herman

From: es-discuss-bounces at mozilla.org [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Allen Wirfs-Brock
Sent: Friday, February 20, 2009 12:15 PM
To: es-discuss at mozilla.org
Subject: parseInt and implicit octal constants

15.1.2.2 says:
When radix is 0 or undefined and the string's number begins with a 0 digit not followed by an x or X, then the implementation may, at its discretion, interpret the number either as being octal or as being decimal. Implementations are encouraged to interpret numbers in this case as being decimal.

This is item 3.10 in the JScript Deviations document and my notes  from when we reviewed the deviations document for
ES3.1 changes says we decided to disallow the octal interpretation in ES3.1.  However that change has never been made in the ES3.1 draft.

Does anyone remember if there was a subsequent explicit decision to keep the ES3 status quo or is this just an editing oversight?

Note that IE, FF, and Safari all interpret leading 0 strings as octal while Opera does not.  So, arguably ,the de facto standard is to support such octal strings.

The argument for removing the option and mandating either one of the alternatives is improved interoperability across all browsers over the long term.
The argument for disallowing such implicit octal strings is that they are an error hazard.
The argument of requiring support of implicit octal strings is that it is the de facto standard of the web and that disallowing them may break existing webapps.

The cop-out is to just leave it as it is.
The safe decision is to mandate the current  de facto standard.
The brave (ie, risky) decision for a better long term language is to disallow octal.

Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090220/103c5996/attachment.html>


More information about the Es-discuss mailing list