"Model 2" prototype status
Brian Goetz
brian.goetz at oracle.com
Sat Aug 1 21:48:07 UTC 2015
> I dislike the Foo<ref> / Foo<any> thing for several reasons.
Not surprising. This wasn't our first choice either.
We spent a great deal of effort investigating whether it was possible to
re-use Foo<?> to mean Foo<ref> when the corresponding tvar is a ref
tvar, and to mean Foo<any> when the corresponding tvar is an any tvar.
Seems obvious, right?
Several hundred hours later, the short answer is that things fall apart
when a library is any-fied and the client is not recompiled; this would
make any-fication a binary-incompatible change, which would be a loser.
So with tears in our eyes, we reluctantly concluded that we needed to
differentiate between Foo<ref> and Foo<any>. Once we swallowed that
pill, many things snapped into place. So as sad as it is to have two
kinds of wildcard, I'm pretty sure its the right call.
You prefer another syntax? Sure, I'm sure there are alternatives. We
can talk about it -- but not this year! We have way more important
things to work out before that comes anywhere near the top of the list.
As to bounds... we're still working out the details of the interaction
between value types and interfaces. So its quite possible that Foo<any
T extends Comparable> may in fact be meaningful. (And if that's the
case, primitives might join the party too.) Or not, we're not sure yet.
More information about the valhalla-dev
mailing list