[jmm-dev] jdk9 APIs
Doug Lea
dl at cs.oswego.edu
Thu Aug 27 11:30:52 UTC 2015
On 08/26/2015 08:01 AM, Doug Lea wrote:
> On 08/25/2015 01:09 PM, Hans Boehm wrote:
>> On Tue, Aug 25, 2015 at 6:22 AM, Doug Lea <dl at cs.oswego.edu
>> <mailto:dl at cs.oswego.edu>> wrote:
>> And plain (non-volatile, non-final) Java vars are also not exactly the same
>> as in C/C++. I and others have gone back and forth on using "getPlain" (etc)
>> vs "getRelaxed" here. Using getPlain sounds odder but might be a better
>> choice.
>
> I'm still torn between odd-soundingness vs reducing chances of confusion.
> Does anyone else have an opinion?
Or, if you can't say anything nice, don't say anything at all.
Just calling them "get" and "set" works out OK in terms of
specs (a few other method names/specs need to be reworked a bit), and
doesn't seem to be overly abuse-prone. So is probably the best approach.
See updated
http://gee.cs.oswego.edu/dl/wwwtmp/Fodder.java
This would not accommodate a suggestion on valhalla list to automatically
equate get/set to relaxed vs volatile versions depending on the declaration
of the field. Which is arguable anyway because it would require tracking down
the declaration site to determine memory semantics.
We'd definitely want to put out a (separate) document showing, for
each C/C++11 construct, how to obtain compatible effects in Java,
and vice versa. The common cases are obvious, but the fact that
Java plain variables are similar to but not exactly the same as
either C++ plain or C++ relaxed leads to a few minor usage differences.
-Doug
More information about the jmm-dev
mailing list