lazy statics design notes

Remi Forax forax at univ-mlv.fr
Thu Feb 28 10:02:10 UTC 2019


----- Mail original -----
> De: "John Rose" <john.r.rose at oracle.com>
> À: "Brian Goetz" <brian.goetz at oracle.com>
> Cc: "valhalla-spec-experts" <valhalla-spec-experts at openjdk.java.net>
> Envoyé: Mercredi 27 Février 2019 22:01:07
> Objet: Re: lazy statics design notes

> On Feb 27, 2019, at 12:58 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
>> 
>> I think the answer to all the objections is "then just use <clinit>".
> 
> That's fair.  Maybe I was overthinking that part.

yes :)

> 
>> Programmers are lazy; we can use this to our advantage.  If the users get the
>> benefit of lazy initialization with one new keyword (lazy-final), they will
>> likely use it because programmers love to prematurely optimize and sprinkling
>> "lazy" is easy.  The result will be, most <clinits> will empty out, except for
>> the ones doing weird stuff.
> 
> Bravo, yes.

yes, for this specific case, premature optimization goes in the direction we want.

Rémi 

> 
>> (This strategy is analogous to: to lose weight, you need not control what you
>> eat, you just need to control what food is in your house.  And you don't even
>> have to do anything here other than "don't buy more unhealthy food"; our
>> natural snacking tendencies will empty out the pantry fast enough, and then all
>> that's left will be kale soon enough.)
> 
> You can *DO* that??


More information about the valhalla-spec-observers mailing list