Re: JavaMemoryModel: Idiom for safe, unsynchronized reads

From: Doug Lea (
Date: Mon Jun 28 1999 - 10:38:09 EDT

One minor amplification on one of Josh's points: The current model
already makes a promise about initial object states (i.e., all-zeros),
so some kind of protection is already needed. The mistake was not
extending this promise to any plausible OO account of construction,
which entails field initialization. Unfortunately, Java initialization
semantics are messy and loose, so it is tricky to graft this on. Life
would arguably have been better if java required constructors to ONLY
initialize fields, with no additional side effects; thus avoiding all
the shoot-yourself-in-the-foot problems. (In CPJ/2e, I strongly urge
people to use constructors solely for field initialization, in order
to avoid encountering these problems in the first place.)

Doug Lea, Computer Science Department, SUNY Oswego, Oswego, NY 13126 USA 315-341-2688 FAX:315-341-5424  
This is the JavaMemoryModel mailing list, managed by Majordomo 1.94.4.

To send a message to the list, email To send a request to the list, email and put your request in the body of the message (use the request "help" for help). For more information, visit

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:13 EDT