tc39/proposal-numeric-separator

Example/use case for separators within octal integer literal?

mathiasbynens opened this issue · 5 comments

https://github.com/tc39/proposal-numeric-separator#octal-literal mentions that separators in legacy octal integer literals (e.g. 01234567) are not supported, but it fails to mention that the proposal does support separators in (non-legacy) octal integer literals, e.g. 0o123456, and it doesn’t give an example nor does it motivate the use case.

Can this be clarified + an example be added please? I’m struggling to think of a use case for separators in octal integer literals. Where would it make sense to even put the separators?

hahahahaha

@mathiasbynens we have a few examples now after #48, but there is not much of a clarification, I admit.

I'd say separators are conventionally available in all non-legacy numeric literal representations, including BigInt and I remember that was an expressed intention. While it goes less specific for why we do support octal integer literals, we basically don't make it a special case to exclude the separators. Does it sound fair enough to you?

I added a quick paragraph here 37afbd8

Please reopen this if it's not enough. Feel free to ping me so we can try to improve it.

If the rationale is “we add new features to all non-legacy numeric literal types” that sounds good to me. It would be good to capture that in the readme.

I just noticed I committed the changes in the file before saving it in my editor. Oops.

It's now fixed w/ examples to BigInt literals. Please, let me know if there is anything else I could improve there at this moment.