Octal notation should be more helpful than just fl...
# language-proposals
j
Octal notation should be more helpful than just flagging a compilation error; parsing Octal is an ugly hack in kotlin. having a IDE/compiler expression to recognize the prefix and tell you "something is here, and you can't use it" is suboptimal.
i
I agree, it would be better to reject octals in the compiler frontend rather than in the parser. Here is an issue for that: https://youtrack.jetbrains.com/issue/KT-5486
j
why would the front-end have any concept of octals at all?
i
In order to recognize them among number literals and then prohibit using them.
j
rejecting octals seems likea goal, im not sure how that serves productivity though. ignoring leading 0'z as nothing special seems less troublesome, unless im missing something. recognizing octals and parsing them also makes sense in contrast to adding workarounds by recognizing them
i
ignoring leading 0'z as nothing special seems less troublesome
You mean parsing the rest as a decimal number? It can be deceiving when one copies octal constants, say, from code in another language where they are allowed.
j
adding a roadblock instead of toInt(radix=8) is more optimal ? IETF is not going to stop publishing octals, POSIX is not going to remove octals from specifications.
https://youtrack.jetbrains.com/issue/KT-44409 ends with only a workaround, but iiuc you state above that the means of users discovering this issue to be more efficiently implemented by passing leading zeros into the front-end; or signalling the front-end by other means that an exceptional condition should be raised. This is something one might attribute to a software project whereupon the system is working, and the founding creative leadership of the project has moved on to other things, vesting trust and esteem to the next generation of torch-bearers to carry on a legacy. Should I recall the whereabouts of this passage in software lore I will be sure to follow up with it here, it's certainly an interesting way to think about a software system over time.
i
Thanks for dropping your observations in comments about octal prefixes in other languages, it is really useful. I've noticed numbers in brackets there, were they intended as some kind of links?
j
updated
so js had it, then dropped it, now they want it back.