diff options
author | Enrico Tassi <Enrico.Tassi@inria.fr> | 2014-12-12 18:19:22 +0100 |
---|---|---|
committer | Enrico Tassi <Enrico.Tassi@inria.fr> | 2014-12-17 15:05:04 +0100 |
commit | eb1eddf24932232890e32acf0fc4ff418ad0c281 (patch) | |
tree | dfc7ee63bff57c21f28aacb7d57a634d35eacedd | |
parent | cee56f902fdae8a3de13ea93f0209f08ac256b08 (diff) |
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.
-rw-r--r-- | lib/dyn.ml | 2 | ||||
-rw-r--r-- | lib/dyn.mli | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/lib/dyn.ml b/lib/dyn.ml index abb2fbcee..d6f539311 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 00c030177..7bbe905cc 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 |