[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Data sharing in java
Jeremy Martin wrote:
> ...But I would
> like to have some kind of design rules that give a formal guarantee
> that no errors can arise due to data sharing, i.e. if the java program
> were tranformed so that every assignment
>
> A = B;
>
> were changed to
>
> A = (B).clone();
>
> then the answer would be the same.
I can't see how this could be possible, because
A = B;
A.radius = 24.0;
and
A = (B).clone();
A.radius = 24.0;
give different state (in the latter case, B.radius is not altered).
Java uses its direct reference model to support closely the entity
relationship modelling at the heart of O.O. In many cases, this is a clear
benefit. But when it comes to writing multi-threaded programs, it can confuse
matters somewhat. We have 'progressed' from the copy-assignment typical of
earlier languages like occam and Ada; I sometimes wonder whether we are poised
to progress onto another generation that encompasses concurrency rather better
than O.O. does. Time will tell!
Rick
--
Richard Beton B.Sc. C.Phys. M.Inst.P.
Roke Manor Research Limited (http://www.roke.co.uk/)
ICQ: 56840977. Homepage: http://www.beton.freeserve.co.uk/
------------------------- Standard Disclaimer Applies
-------------------------
The information contained in this e-mail is confidential to Roke Manor and
must
not be passed to any third party without permission. This communication is for
information only and shall not create or change any contractual relationship.
-------------------------------------------------------------------------------