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 t
val name : 'a t -> string
val set : 'a t -> 'a -> unit
val get : 'a t -> 'a
val undef : 'a t -> unit
val isdef : 'a t -> bool
true
if the global value has been set.val opt : 'a t -> 'a option
None
if the global is undefined, else Some v
where v is the
current global value contents.