ToNumber("0b1001")

# Domenic Denicola (13 years ago)

I was going over the latest draft and noticed that, while binary and octal literals have been introduced in 7.8.3, they weren’t added to 9.1.3.1 (“ToNumber applied to the String type”). Should they be?

Pros: symmetry. Cons: breaks backward compatibility (currently ToNumber("0b1001") returns NaN).

# Brendan Eich (13 years ago)

Domenic Denicola wrote:

I was going over the latest draft and noticed that, while binary and octal literals have been introduced in 7.8.3, they weren’t added to 9.1.3.1 (“ToNumber applied to the String type”). Should they be? Pros: symmetry. Cons: breaks backward compatibility (currently ToNumber("0b1001") returns NaN).

That's the reason why. We can make early errors in ES1-5 into new syntax without backward incompatibility, but runtime-only errors are risky enough that there's no upside. A new API, to be invoked explicitly, is the way to go.

Implicit conversions in JS are the big unfixed wart in ES6, again preserved for compatibility (1JS).