by Graf Zahl » Mon Oct 17, 2016 3:26 pm
There's 4 types of constants:
ints, floats, strings and names.
Strings can be unambiguously recognized by double quotation marks.
Names can be unambiguously recognized by single quotation marks.
Floats get recognized by either being too large for integer storage or typical floating point signs in the literal, like a decimal point or an exponent
And in case you wonder what this part was inspired by, I'd say don't look further than the most popular scripting language right now: Lua. Of course Lua takes the 'the value determines the type' approach even further by applying it to everything.
There's 4 types of constants:
ints, floats, strings and names.
Strings can be unambiguously recognized by double quotation marks.
Names can be unambiguously recognized by single quotation marks.
Floats get recognized by either being too large for integer storage or typical floating point signs in the literal, like a decimal point or an exponent
And in case you wonder what this part was inspired by, I'd say don't look further than the most popular scripting language right now: Lua. Of course Lua takes the 'the value determines the type' approach even further by applying it to everything.