Closed qwertie closed 4 years ago
I also wonder if I erred by using '++suf
as the name of post-increment (and similarly for other suffix operators). I kinda think 'suf++
would read better. But now that I've made this proposal, I wonder if '_++
would be a good name for post-increment, as _++
is a bit similar to this proposal, with _
acting as a placeholder, this time for an expression, to remind you that the ++
appears afterward.
This has been implemented for v28.0.
Before today my plan was that
1234x
andx"1234"
would be semantically identical, but on further reflection, perhaps some would like to be able to distinguish numeric literals from string literals that use the same type marker (in this example,x
).To that end we could decree that the type marker on
1234x
is_x
. You could think of the underscore as a reminder of suffixness, i.e. "_x" means "something followed by x". In this way it is still possible to express it in string form as_x"1234"
, it's just a bit longer, butx"1234"
has a different type marker and therefore, conceptually, has a different data type. The underscore could also act as a signal to the LES printer, telling it "I want this string to be printed in numeric style if possible".IIRC, the old plan was to use
n
as the type code on unadorned numbers, so1234
meansn"1234"
. If we adopt this idea then 1234 would mean_"1234"
instead.As LESv3 does not support negative numbers in numeric format, it is necessary to write negative literals in string form:
_"-123"
. So the downside of this proposal is that explicitly-typed negative literals would become one character longer:_i32"-1234"
. (LES newbies take note: you can write-1234
of course, but that is not a negative 1234 literal, it is a positive 1234 literal with a negation operator applied to it.) CC @jonathanvdc