From eb1eddf24932232890e32acf0fc4ff418ad0c281 Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Fri, 12 Dec 2014 18:19:22 +0100 Subject: Dyn: add API to check of two Dyn.t are == A Dyn.t boxes a type tag with the original object, so calling == on the Dyn.t does not work, hence this extra API. --- lib/dyn.ml | 2 ++ lib/dyn.mli | 1 + 2 files changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/dyn.ml b/lib/dyn.ml index abb2fbceec..d6f5393116 100644 --- a/lib/dyn.ml +++ b/lib/dyn.ml @@ -45,3 +45,5 @@ let tag (s,_) = with Not_found -> let msg = Pp.str ("Unknown dynamic tag " ^ (string_of_int s)) in anomaly msg + +let pointer_equal (t1,o1) (t2,o2) = t1 = t2 && o1 == o2 diff --git a/lib/dyn.mli b/lib/dyn.mli index 00c0301779..7bbe905cce 100644 --- a/lib/dyn.mli +++ b/lib/dyn.mli @@ -13,3 +13,4 @@ type t val create : string -> ('a -> t) * (t -> 'a) val tag : t -> string val has_tag : t -> string -> bool +val pointer_equal : t -> t -> bool -- cgit v1.2.3