Is it really a good idea for octal numbers to allow capital-O, e.g. 0O755?
It was decided to allow it for consistency with 0XFF and 0B11 and leave this up to style guides and linters.
FWIW, I d0On't like it neither
I'm with Jeff. YAGNI, YouWillHateIt, ItWillMakeYourEyesBleedWhenYouLeastExpectIt. Remember homomorphic URL phishing attacks?
var Oo22 = 60
window.alert(Oo22 - 0o22) // 42 O_o
Indeed, you ain't gonna need it for obfuscating your code, there's already more than one way to do it. :-)
Since there won't be much code containing words starting with OO, O0, 0O or 00, the risk of eye-bleeding is low. OT0H, it would only be good for facilitating the work of obfuscators (all their numerical constants will start with 0O or 00, and all their variables with OO or O0 followed by digits).
Claude Pache wrote:
the risk of eye-bleeding is low.
My eye already bled just from this thread!
The decision of record, including a rationale citing lack of control over "lookalikes"
var n = 0O755;
Is this something anyone wants to read? I certainly don't! Allowing only lowercase 'o' in octal literal syntax is inconsistent with 'x' and 'b', but on balance I think that's probably preferable to admitting this monstrosity. :-) (Which isn't to say I care strongly enough to spend a whole bunch of time arguing the point, only enough to raise it as a concern and see if others agree.)