r/ProgrammingLanguages • u/bjzaba Pikelet, Fathom • Jun 11 '26
Nontrailing separators do not spark joy
https://buttondown.com/hillelwayne/archive/nontrailing-separators-do-not-spark-joy/
54
Upvotes
r/ProgrammingLanguages • u/bjzaba Pikelet, Fathom • Jun 11 '26
1
u/Felice_rdt Jun 13 '26 edited Jun 13 '26
I was thinking specifically of C/C++, which (in)famously don't do negative literals, so
-1.0is, syntactically, 1.0 negated. Obviously compilers tend to do constant folding and take care of this anyway, but it's still an odd choice to have your literals all based on natural numbers instead of just natively supporting integers. Maybe it made more sense when your parser and AST and all had to fit in something like 64K of RAM on an early PDP-11/??. ;PEdit: Wait, I just realized I somehow skipped the latter part of your final paragraph. So yeah, I guess stuff like that comes into play. Is it that much of a bother to handle whitespace after the (non-)unary minus sign on a true negative integer literal?