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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Tahir H Butt <tahir@a...>
Subject: [Caml-list] comparing references
I don't know for sure, so I decided to ask around. My question is this:
given two references, when one compares them, is it just the addressing
which is examined, or the actual content? For instance:

type symbol = Symbol of int
let a = ref (Symbol 1) in
let b = ref (Symbol 2) in
let c = ref (Symbol 1) in
....

upon inspection, a=c -> true, and a=b -> false, as desired. But, is this
comparison as simple as comparing two numbers? I ask because my sum
types can be big (I'm dealing with trees), so it would be good if when I
want to check if two trees are the same, all I need to do is look at the
references to them.

Thanks,

Tahir H Butt
Brown University
Cognitive and Linguistic Sciences
PhD Student
http://www.cog.brown.edu/~tahir

-------------------
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