Actually, you are more on my side because what i'm proposing make V? less present in public methods of API, which i think is a good move in term of perf model and for ArryList<N?>, both proposal work the same.
Rémi ----- Mail original ----- > De: "Doug Lea" <d...@cs.oswego.edu> > À: "valhalla-spec-experts" <valhalla-spec-experts@openjdk.java.net> > Envoyé: Mercredi 1 Mai 2019 16:32:18 > Objet: Re: Is V? what we need ? > On 5/1/19 10:12 AM, Brian Goetz wrote: >> >> You’re assuming the utility of V? after reification is zero, but >> that’s not the case. For example, suppose ArrayList is reified. Then >> the user gets the choice of erasure or reification by selecting >> ArrayList<V?> or ArrayList<V>. Erasure has a bad rap, but sometimes >> it is desirable. > > As I tried but failed to get across in post on sorting, choosing V vs V? > can lead to 5X cost differences in *either direction* for common > aggregate (collection and array) operations. So programmers will need to > learn some of these consequences. (Which is made harder/worse here > because the cost tradeoffs will probably change over time as VM support > improves.) > > Which is mainly an argument for Brian's position, except for those who > believe that Java programmers should not have to encounter these kinds > of issues that C++, C#, OCAML, etc programmers face all the time; > betting that somehow VMs will make the right choice. > > (Maybe this is not the right time to mention this, but most other > languages supporting this range of use have a middle-ground of > call-by-ref for extracting small parts of large things, as seen in > comparators, hash-codes, etc that can make a big performance difference. > I expect people will complain about not supporting this.) > > -Doug