[jmm-dev] ECOOP, JVMLS
John Rose
john.r.rose at oracle.com
Tue Aug 5 07:17:29 UTC 2014
On Aug 3, 2014, at 5:36 AM, Doug Lea <dl at cs.oswego.edu> wrote:
> * Everyone seems to strongly favor the idea of replacing final-field
> specs with those that amount to guaranteeing release fences in
> constructors. Still lots of details (some depending on core model) to
> work out though.
This change makes it easier to define interesting variations on final variables. Such finals would be set some time after their constructor exits. Scala-style lazily evaluated fields are an example; also no-copy builder APIs for immutables. Finals could also be elements of monotonically initialized constant arrays. A final set outside of a constructor (or final array element set) would be followed immediately (or on exit from enclosing method?) by a release fence, giving safe publication for the final value. (A reader would have to test carefully for the empty state, if the object was published beforehand.)
— John
More information about the jmm-dev
mailing list