package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=d02c4f044e53edca010de46f9139ce00
sha512=99a5afa3604c4cf0c849c670111d617f7f255acb0da043b73ddffdf0e299948bce52516ee31921f269de6088156c4e0a187e0b931543c6819c6b25966b303281
doc/batteries.unthreaded/BatGlobal/index.html
Module BatGlobal
Source
Mutable global variable.
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.
Abstract type of a global
Raised when a global variable is accessed without first having been assigned a value. The parameter contains the name of the global.
Returns an new named empty global. The name of the global can be any string. It identifies the global and makes debugging easier. Using the same string twice will not return the same global twice, but will create two globals with the same name.
Get the global value contents - raise Global_not_initialized if not defined.
Return None
if the global is undefined, else Some v
where v
is the current global value contents.