module Global:Mutable global variable.sig..end
Often in OCaml you want to have a global variable, which is mutable
and uninitialized when declared. You can use a 'a option ref but
this is not very convenient. The Global module provides functions
to easily create and manipulate such variables.
type 'a t
exception Global_not_initialized of string
val empty : string -> 'a tval name : 'a t -> stringval set : 'a t -> 'a -> unitval get : 'a t -> 'aval undef : 'a t -> unitval isdef : 'a t -> booltrue if the global value has been set.val opt : 'a t -> 'a optionNone if the global is undefined, else Some v where v is the
current global value contents.