Generics syntax
Daniel Bonniot <[email protected]> Sat, 05 Mar 2005 09:38:33 +0100
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
Hi everyone, I have been wondering whether we should change somethings in the syntax of generics (type parameters). Unbounded generics <T> would not be affected. For bounded (or constrained) generics, the current syntax is <Bound T>. On the other hand, Java 5 has syntax <T extends Bound> to represent exactly the same thing. This is unfortunate, because for people familiar with Java 5, it will be an unnecessary burden to remember the difference. Besides, their syntax looks completely fine, so it's not like we have a strong reason to be different on this syntactic point. While we are at it, we could as well implement wild cards (as in List<?>). Nice's type system is expressive enough that this can be implemented as syntactic sugar only. Are there other Java 5 generics syntactic constructs that we don't support yet? As far as I know, the only one is interface Foo<T extends Foo<T>> because we have something simpler which doesn't need these confusing recursive bounds: abstract interface Foo ;-) (Of course, there are several generic constructs that can only be done in Nice: genericity on a type constructor/class and partial polymorphism using abstract interfaces, at least) Comments? As usual, if we change the syntax, there will be ample time for people to convert their code, with only warnings to help them do so. Cheers, Daniel ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click