Fwd: more background to List<int> specializing List<Any>

Gavin King gavin at hibernate.org
Mon Jan 5 00:59:24 UTC 2015


On Mon, Jan 5, 2015 at 1:48 AM, Gavin King <gavin.king at gmail.com> wrote:

> You mean List<int> would be a List<? extends Integer>, right?

And, by the way, I still don't see why this would not be doable *even
with value types in the picture*. The concrete types ArrayList<int>
and ArrayList<Integer> are necessarily disjoint. Therefore,
implementation based on specialization is still workable, whether
we're talking about primitives or value types.

The only issue that comes into play is when you invoke get() on a
wildcard instantiations like ArrayList<? extends Integer>. Then, in
this case, you need to make whatever bytecode-level invokexxxxx
instruction we have smart enough to so that we dispatch to the right
specialized implementation of get(). But that to me sounds totally
doable. Doesn't invokedynamic already do that?



--
Gavin King
gavin at ceylon-lang.org
http://profiles.google.com/gavin.king
http://ceylon-lang.org
http://hibernate.org
http://seamframework.org


More information about the valhalla-dev mailing list