You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It's common to input numbers in a different base than the decimal system (especially if they're taken from a source where they're represented that way). Many languages have a support for different bases, usually at least binary, octal and decimal, in the format of number literals.
Describe the solution you'd like
Extend the syntax of number literals to accept hexadecimal notation (0x prefix), octal (0o prefix) and binary (0b).
Describe alternatives you've considered
Do nothing, and simply require the users to convert their numbers to base 10.
One small caveat here ist that Nickel number literals are rational numbers by default. Since so few languages make actual use of hexadecimal fractional numbers, I think we should at least start by only allowing integers to be written in bases other than 10.
Fair enough. I tried in the console out of curiosity and JavaScript also only accepts integers to be written in hexadecimal notation (not that JavaScript is often a good model as far as language design goes, but at least it's a data point of another language with only one type of number 🤷 )
Is your feature request related to a problem? Please describe.
It's common to input numbers in a different base than the decimal system (especially if they're taken from a source where they're represented that way). Many languages have a support for different bases, usually at least binary, octal and decimal, in the format of number literals.
Describe the solution you'd like
Extend the syntax of number literals to accept hexadecimal notation (
0x
prefix), octal (0o
prefix) and binary (0b
).Describe alternatives you've considered
Do nothing, and simply require the users to convert their numbers to base 10.
Additional context
Initially proposed by @Quantum64 on Discord.
The text was updated successfully, but these errors were encountered: