Commits

camlspotter committed 2286e1b

once

Comments (0)

Files changed (3)

    xgc
    spot
    uniqueID
+   once
 
 LIB = spotlib
 
+type 'a t = 'a option ref
+
+let create () = ref None
+
+exception Already_initialized
+
+let set x v = match !x with
+  | Some _ -> raise Already_initialized
+  | None -> x := Some v
+
+let get x = !x
+type 'a t
+
+exception Already_initialized
+
+val create : unit -> 'a t
+
+val set : 'a t -> 'a -> unit
+(** Raises Already_initialized when already set *)
+
+val get : 'a t -> 'a option
+