RE: JavaMemoryModel: A new box for the Java Memory model

From: David Holmes (dholmes@ics.mq.edu.au)
Date: Tue Nov 09 1999 - 22:29:58 EST


> From: Joshua Bloch [mailto:jbloch@eng.sun.com]
> >In any case extending the semantics to cover array elements
> would be for completeness only. The new semantics of volatile and final
can
> be defined without any reference to arrays.
>
> I don't get it. Do we need it or don't we?

We can define extended semantics for volatile and final that deal with
memory model issues the way we want them to. It is then up to the
programmer to use final and volatile fields in the appropriate ways.
However, if the programmer has a situation where a shared reference is an
array member then the language does not permit marking array members as
volatile or final. Consequently the programmer would be forced to use
either synchronised accessors around the array member or stop using an
array.

Hence the lack of ability to mark array members as final or volatile does
not affect our ability to define enhanced semantics for final and volatile
fields. On the other hand without the ability to mark array members as
final or volatile we will force programmers to change the way they are
doing things in some situations. So as I said - for completeness we should
look at this language extension, but any redefinition of final and volatile
is independent of that language extension.

David

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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