Hacker News new | comments | show | ask | jobs | submit login

See this comment above in this thread: http://news.ycombinator.com/item?id=2442468

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.

sorry, but are you sure a C# problem applies to Java?

AFAIK the syntax for passing type arguments to a generic method in the latter would be


is once again unambiguous, at a syntactic level.

It would seem the java designers thought of the issue :)


Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact