This module provides a simple way to assign and read fully backtrackable global variables.
Global variables differ from storing information using dynamic predicates:
The implementation is based on a globally reachable structure in the heap, where each entry is allocated dynamically for each key.
Note that the current implementation has some limitations (see bug entries in this module).
Usage:setval(Name,Value)
Associate the term Value with the atom Name. If Name does not refer to an existing global variable, an unbounded global variable Value is created and unified to Value. On backtracking the assignment is reversed. If Name is not a atom the predicate silently fails.
Usage:getval(Name,Value)
Unifies Value with the current value of the global variable refered to by the atom Name. If Name does not refer to an exisiting global variable, a free unbound variable is created and unified with Value. If Name is not an atom the predicate silently fails.
Usage:current(Name,Value)
Enumerate all defined variables with their value. The order of enumeration is undefined.