Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Semantics of physical equality
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andreas Rossberg <AndreasRossberg@w...>
Subject: Re: [Caml-list] Semantics of physical equality
sejourne kevin <sejourne_kevin@yahoo.fr> wrote:
>
> http://caml.inria.fr/ocaml/htmlman/libref/Pervasives.html
> 
> Ho!
> A definition for mutable structures look ambiguous to
> me:
> 
> type test = 
> {
> mutable a:int;
> b:int
> };;
> 
> let r = {a=0;b=2};;
> 
> let x = r and y = r in 
> assert((x.a==y.a)&&(x.b==y.b)&&(x==y))
> ;;
> 
> Does this always ok ?

No, only

  let x = r and y = r in
  assert (x == y)

Neither r.b nor r.a are mutable, only r itself is.

     - Andreas

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners