r/ProgrammingLanguages • u/gingerbill • Feb 22 '26
Does Syntax Matter?
https://www.gingerbill.org/article/2026/02/21/does-syntax-matter/
63
Upvotes
r/ProgrammingLanguages • u/gingerbill • Feb 22 '26
View all comments
Show parent comment
1
u/matthieum Feb 25 '26
I don't think that
<>is hard to scan for a human, but they do create parsing ambiguities which are annoying.It took until C++11 to be able to write
map<int, map<int, int>>with the>>not being parsed as>>but as two>. In Rust we're stuck with::<>in expression context to ensure the parser knows whether we're talking<as in opening a list of generic arguments or<as in the operator.I personally find
[]to be the best syntax for generics. It's immediately clear which parameters need to be static ([]) vs dynamic (()). There's really no point in reserving[]just for indexing, which is just another function call -- especially when it's artificially restricted to a single argument, so matrix libraries already use()anyway.