Commits

camlspotter  committed f657dcb

added UniqueID #NEW

  • Participants
  • Parent commits 42bcaf6

Comments (0)

Files changed (2)

File lib/uniqueID.ml

+type t = int ref
+
+let create () = ref 0
+
+let get r =
+  let v = !r in
+  if v < 0 then failwith "UniqueID.get: overflow";
+  incr r;
+  v

File lib/uniqueID.mli

+type t
+
+val create : unit -> t
+
+val get : t -> int
+(** [get t] creates a new id positive integer (>=0). 
+    It may raise [Failure "UniqueID.get: overflow"]
+*)