Hacker News new | ask | show | jobs
by Sharlin 2187 days ago
C++ and Rust require extra disambiguating syntax in some contexts (C++ the `foo.template bar<T>()` syntax, Rust the "superfish operator" `foo.bar::<T>()`. Java works around the problem by awkwardly putting the generic argument list in front of the method name (`foo.<T>bar()`). I don't know about C#.
3 comments

C# is `foo.bar<T>()`, I’m not sure what compromises that had to make for that to work but from an end-user perspective it works well.
They parse it one way, and if they figure out the other parse option was right, they go back and fix the parse tree.

Basically, unlimited look-ahead.

Is it somehow a problem?
(teeny tiny note: turbofish, not superfish)
Oops :D
Using [] is the optimal choice for languages in general, but they can't even use that because they blew away that syntax for indexing.
Scala uses [] for generics and () for indexing, which sort of makes sense given that in the end arrays are just functions.
So are the uninstantiated generic types ;-)