Honestly, I do not see a big advantage in this Pre-SIP.
Did I miss something?
Compared to regular string literals/interpolation, you only save up to one char. And also only, if it is not followed by )
or .
(or ,
, as it is used in big#345,463
above?)
But I think most literals are followed by one of those characters.
I get that it “feels” less like a number if enclosed in doublequotes, but is
ip#192.168.1.0 .connect //OK
really any better than
ip"192.168.1.0".connect
? (maybe that’s more of a syntax highlighting issue?)
And I do not think it is worth all the new ambiguities it introduces.
For another example, I don’t think most people could immediately tell what the following lines should or would do.
Integer.toString(big#543,210) // a
Integer.toString(big#543, 210) // b
Integer.toString(big#543 ,210) // c
Integer.toString(big#543 , 210) // d
Especially, as the most familiar-looking one, b, is the only one that would not compile (as one literal big#543,
is directly followed by another, 210
).
In contrast, I think these two are very readable:
Integer.toString(big"543,210") // e
Integer.toString(big"543", 210) // f
(I know, Integer.toString(num, radix)
for radix > 36
is doomed anyway, but it’s only about syntax here )
If you’d introduce a proper end-character such as ;
or a second #
, I think all these problems go away.
Although that’s more or less just another very similar syntax for what we have with normal string interpolators, it could be interesting for numeric data types, especially if processed in the compiler phase by default.
And it would be much mor capable than FromDigits
which just always isn’t enough)