lazy statics design notes
john.r.rose at oracle.com
Wed Feb 27 21:01:07 UTC 2019
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.
> 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.
> (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