Commits

camlspotter committed f657dcb

added UniqueID #NEW

Comments (0)

Files changed (2)

+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
+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"]
+*)