<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<br>
<blockquote type="cite" cite="mid:1092576884.42867927.1682543244717.JavaMail.zimbra@univ-eiffel.fr">
<div style="font-family: arial, helvetica, sans-serif; font-size:
12pt; color: #000000">
<div data-marker="__QUOTED_TEXT__">
<div style="font-family: arial, helvetica, sans-serif;
font-size: 12pt; color: #000000">
<div>
<div><br>
</div>
<div>What do you mean by "a class either can be assigned
to, or cannot" ?<br data-mce-bogus="1">
</div>
<div>As far as i know a class can not be assigned.</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
Sorry, typo -- s/class/variable/<br>
<br>
<blockquote type="cite" cite="mid:1092576884.42867927.1682543244717.JavaMail.zimbra@univ-eiffel.fr">
<div style="font-family: arial, helvetica, sans-serif; font-size:
12pt; color: #000000">
<div data-marker="__QUOTED_TEXT__">
<div style="font-family: arial, helvetica, sans-serif;
font-size: 12pt; color: #000000">
<div>
<div>As far as i know, at least in Java, programs with
data races are not automatically broken, it depends on
if the states produces by the data races are valid
states or not.<br data-mce-bogus="1">
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
It is true that some data races are benign; the canonical example
here is the String hashCode. But this trick is (and should be)
exceedingly rare, and for purposes of explaining atomicity to the
other 99.999% of Java users, can be ignored.<br>
<br>
<blockquote type="cite" cite="mid:1092576884.42867927.1682543244717.JavaMail.zimbra@univ-eiffel.fr">
<div style="font-family: arial, helvetica, sans-serif; font-size:
12pt; color: #000000">
<div data-marker="__QUOTED_TEXT__">
<div style="font-family: arial, helvetica, sans-serif;
font-size: 12pt; color: #000000">
<div>
<div><br data-mce-bogus="1">
</div>
<div>The usual example is not declaring a field final even
if the field is initialized only once, in the
constructor, it may result in a publication issue, a
thread can see the instance not fully initialized.</div>
<div>But it can be a problem or not depending on if the
default value of the field is a valid value or not.<br data-mce-bogus="1">
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
I think you may be coming at this from a different direction; you've
got a collection of "interesting corner cases" where a data race
might not be a problem. These are really interesting cases, but
it's focusing on the trees rather than the forest. We don't want to
encourage reasoning about "in this case, data race X is OK". That's
a game for experts -- and most experts know to try to avoid playing
it. <br>
<br>
The point is that "bad things happen in data races", and that
non-atomicity merely *moves the bad things around*. <br>
<br>
<blockquote type="cite" cite="mid:1092576884.42867927.1682543244717.JavaMail.zimbra@univ-eiffel.fr">
<div style="font-family: arial, helvetica, sans-serif; font-size:
12pt; color: #000000">
<div data-marker="__QUOTED_TEXT__">
<div style="font-family: arial, helvetica, sans-serif;
font-size: 12pt; color: #000000">
<div>
<div><br data-mce-bogus="1">
</div>
<div>For me, the non-atomicity of a value class may lead
to more possible states than with the publication issue
where you can only either see the default value or the
assigned value.</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
Yes, it basically trades the bad effects of "mutable ref to
immutable state" for the bad effects of "immutable ref to mutable
state". In the latter, more things can go wrong, because there is
more mutability. <br>
<br>
<blockquote type="cite" cite="mid:1092576884.42867927.1682543244717.JavaMail.zimbra@univ-eiffel.fr">
<div style="font-family: arial, helvetica, sans-serif; font-size:
12pt; color: #000000">
<div data-marker="__QUOTED_TEXT__">
<div style="font-family: arial, helvetica, sans-serif;
font-size: 12pt; color: #000000">
<div>
<div><br data-mce-bogus="1">
</div>
<br>
</div>
</div>
</div>
</div>
</blockquote>
</body>
</html>