Hacker News new | ask | show | jobs
by everforward 682 days ago
Using parens is still problematic because they have semantic meaning in most coding languages, meaning you'll still have to backtrack to the opening paren to decide whether the later paren is closing an expression or a string.

> Is this really that hard compared to everything else?

In the languages I've seen that don't allow numbers in identifiers, it's because doing so makes other expressions ambiguous.

E.g. in Python (et al), things that start with 0x are treated as a hex literal. 0x9 would be ambiguous because it could either be an identifier named 0x9 or a literal for 9 in hex.

It also makes integer literals ambiguous, because 54 would be both a valid identifier and a valid literal.

You could disambiguate that with more rules (identifiers can include numbers but can't start with 0x, identifiers must include at least one non-numeric character), but the gain for doing so is so low it feels a little Quixotic.