Re: JavaMemoryModel: Issue with final fields

From: Eliot Moss (moss@cs.umass.edu)
Date: Fri Feb 01 2002 - 13:54:24 EST


>>>>> "Cliff" == Cliff Click <Cliff.Click@sun.com> writes:

    Cliff> Bill Pugh wrote:

>> I was thinking about the semantics for final fields, and came up with a
>> slightly disturbing example.
>>

[rest of example elided]

    Cliff> Yes it bothers me, but not a lot. You published a bogus Foo.
    Cliff> Anything that touches this bogus Foo is now Bogified (TM). You
    Cliff> and your program will be shot at dawn. :-)

I agree with Cliff -- it bothers me. I would allow the compiler to do the
transformation; but the fact that an improper publication leads to
something bogus does not bother me ... so long as we can guarantee that the
bogus value is type-safe!

(Just like the fact that my concurrent collector may do something bad to
progtrams with data races on non-volatile fields doesn't bother -- people
who code things like that deserve nasty results.)

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



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