list literal gotcha and suggestion

Paul Benedict pbenedict at
Tue Oct 6 12:56:30 PDT 2009

>> The suggestion was made in order to simplify syntax. Evidently, Paul and
>> possibly Neal seem to think that "(List<>){{1, "One"}, {2, "Two"}})" is
>> simpler than "[[1, "One"], [2, "Two"]]".
> Not at all.  I believe that the cast would be unnecessary in virtually all
> use contexts, just as the cast from "3" to "byte" is unnnecessary in
> virtually all use contexts.

Reinier, I evidently misunderstood Neal. I thought he was saying
casting would still be possible if the compiler couldn't resolve it
(like in the example you showed). Although Neal says casting will
typically never be required, it could still be necessary for edge
cases, right? In any event, I'd rather have the compiler infer
everything it can whenever possible.

> You seem to imagine that the type has to be denotable in java source.  That
> is certainly NOT a requirement.

Neal, if it is not denotable in the source, would it still appear in
javax.lang.model.type ?


More information about the coin-dev mailing list