People, please learn from mistakes of the past. Using less-than and greater-than as template parameters was a horrible idea by Stroustroup, but was copied by Java and C#.
Although C# and Java do not suffer from the craziness that is C++, by virtue of requiring a class name, e.g.
If quotes are used for grouping characters (as they are in C, Java, C#, Python etc.) then this is just as bad as using <>. How can you tell if it is a character literal or a type?
Maybe, but the problem was that "all lexing/parsing/syntax highlighting/analysis of the language is much harder because of this horrible choice". Using quotes doesn't really fix that.
The problem is that you often need to decorate a generic parameter with additional information (like its type constraints or variance). If the type parameter doesn't have a singular place where it's "declared", there's no convenience place to do that. In your example, how would you specify that T must implement Summable?
The statement: F(G<A, B>(7));
could be interpreted as a call to F with two arguments, G < A and B > (7).
Alternatively, it could be interpreted as a call to F with one argument, which is a call to a generic method G with two type arguments and one regular argument.
is this really a big deal? I wrote my share of Java code with generics and the issue never popped up, because generics are way more restricted than c++'s templates. E.g.
myclass<3>4>
can only be a syntax error because you can't have a value in there, inly a type name
Ok. Still, it makes syntax highlighting and everythink lexical so much harder and ambivalent (think a<b<c>> - close paren or right shift?) with no benefit compared to e.g. []
again a syntax error, you can't have generics in an expression in which operators such as > are allowed, the java syntax is really simple and unambiguous to parse.
On the other hand, [] is used for arrays in java so it _would_ conflict with something
It is a semantic error, not a syntax error (in the sense that an annotated grammar CANNOT, without semantic analysis, find that this is an error).
The example given in this comment, F(G<A,B>(7)) is syntactically ambiguous and can only be resolved to either F( (G<A) , (B>(7) ) - a two argument function call, or F( (G<A,B>(7)) ) - a one argument function call - when the types of F, G, A and B are known.
Also, things like F<G<A>> (which are perfectly legal) make lexing very hard - you can't assume '>>' is the shift right token without syntactic (and semantic) analysis. Or, you can decide like early C++ that you must write it F<G<A> > which is confusing.
Although C# and Java do not suffer from the craziness that is C++, by virtue of requiring a class name, e.g.
is unique to C++ - but still, all lexing/parsing/syntax highlighting/analysis of the language is much harder because of this horrible choice.For heaven's sake, please use {} or [] or some other character which does not also function as an infix operator.
(Even APL and K, which overload every character in fifty different ways, don't mix grouping with infix operators)