Fwd: Remi's comments on Any

Remi Forax forax at univ-mlv.fr
Mon Jan 5 13:50:06 UTC 2015


On 01/05/2015 12:35 PM, Gavin King wrote:
> On Mon, Jan 5, 2015 at 12:27 PM, Remi Forax <forax at univ-mlv.fr> wrote:
>
>> and the best way to avoid concrete instantiation of ArrayList<Any>,
>> is not to use a *use-site* annotation like a wildcard but a *declaration
>> site*
>> like
>>    class ArrayList<any T> { ... }
> I don't see how that's right. Then how would I write down the
> instantiation ArrayList<? extends Any>?
>
> When I'm saying we don't necessarily need to let you write:
>
>      ArrayList<Any> list = new ArrayList<Any>();
>
> I'm not saying we don't need to let you write:
>
>      ArrayList<? extends Any> list = new ArrayList<int>();
>
> I don't understand how you're proposing to write this second example.

ArrayList<? extends Object> list = new ArrayList<int>().boxed();

>
>> boxing make ArrayList<Any> is not too different from ArrayList<Object>,
>> and tagged union will only happen in an alternate universe (never say
>> never).
> I still don't understand the resistance to the tagged union Any. It's
> surely way, way, way easier to implement than the value types
> proposal, and could be implemented at the same time.

no, it's the opposite, value type can be implemented as a JIT only 
optimisation
(if you forget data structure specialization) by example, the change is 
not as pervasive as Any.

Rémi




More information about the valhalla-dev mailing list