Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Newbie question: semantics of 'mutable' in relation to deep / shallow copying of CAML values.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] Newbie question: semantics of 'mutable' in relation to deep / shallow copying of CAML values.
On Thu, Nov 22, 2001 at 12:25:04PM -0000, Gerard Murphy wrote:

> Surprise! 'value2' is sharing state with 'value1', but neither
> 'value1' nor 'value2' are CAML references.

There is no specific notion of "reference" in OCaml: the type "ref" is
actually implemented as a mutable record:
   type 'a ref = { mutable contents : 'a }

 !x is just a shortcut for x.contents
  x := y is just a shortcut for x.contents <- y

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr