[records] Ancillary fields

Victor Nazarov asviraspossible at gmail.com
Wed Apr 18 20:34:08 UTC 2018


Awesome, thanks!

Your phrase "We'd then say that records can only have additional _lazy_
instance fields." got me confused. So it should really be "records can only
have additional final or lazy instance fields with initializers".

--
Victor Nazarov

ср, 18 апр. 2018 г., 23:29 Brian Goetz <brian.goetz at oracle.com>:

> Yes, you can say
>
>      static final int x = f()
> or
>      static final lazy int x = f()
>
> one is eager, the other lazy.
>
> > Yes, but what about precomputed cached values, that are trully lazy?
> > Can we add ancillary final fields with initializers? Such final fields
> > have less initialization cost than lazy ones.
> >
>
>


More information about the amber-spec-observers mailing list