Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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.


Tahir H Butt
Brown University
Cognitive and Linguistic Sciences
PhD Student

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: