News for hackers. Stuff that matters.
Re:Red Hat's top secret Java Killer/Successor: The Ceylon Pr... by riffraff on Wednesday April 13, 2011 @10:20AM (#2442295)
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
Re:Red Hat's top secret Java Killer/Successor: The Ceylon Pr... by beagle3 on Wednesday April 13, 2011 @11:03AM (#2442539)
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. []
Re:Red Hat's top secret Java Killer/Successor: The Ceylon Pr... by riffraff on Wednesday April 13, 2011 @01:05PM (#2443153)
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

Re:Red Hat's top secret Java Killer/Successor: The Ceylon Pr... by beagle3 on Wednesday April 13, 2011 @05:41PM (#2444365)
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.

Re:Red Hat's top secret Java Killer/Successor: The Ceylon Pr... by riffraff on Thursday April 14, 2011 @12:34PM (#2447437)
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

   obj.<A,B>G(7)
so

   F(G<A,B>(7))
is once again unambiguous, at a syntactic level.

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