Fwd: Remi's comments on Any
Remi Forax
forax at univ-mlv.fr
Mon Jan 5 11:27:43 UTC 2015
On 01/05/2015 02:20 AM, Gavin King wrote:
[...]
>> I am _totally_ happy with reftypes & boxing as our base case, only code
>> which has been specialized is expected to perform better, performance on
>> List<Object> is not at issue.
> Well the really interesting thing is that in principle you don't even
> necessarily need to allow a concrete instantiation ArrayList<Any>! You
> could prevent people from writing "new ArrayList<Any>()" if you
> prefer, and I for one would still be happy enough!
>
> If you did that, instantiations like ArrayList<? extends Any> would
> only be *use-site* instantiations. This would still be enough fix the
> bothersome properties of the type system that I'm objecting to.
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> { ... }
join us to the dark side ...
>
> I'm not advocating that, however. FTR, I don't see anything wrong with
> ArrayList<Any>, whether implemented using boxing or using a tagged
> union.
>
boxing make ArrayList<Any> is not too different from ArrayList<Object>,
and tagged union will only happen in an alternate universe (never say
never).
Rémi
More information about the valhalla-dev
mailing list