This package contains a library for handling global variables in PAKCS. A global variable has a name declared in the program. Its value (a data term possibly containing free variables) can be accessed and modified by IO actions.
In contast to global entities (as defined in the library Global), global variables can contain logic variables shared with computations running in the same computation space. As a consequence, global variables cannot be persistent, their values are not kept across different program executions.
Currently, it is still experimental so that its interface might be slightly changed in the future.
A global variable
g with an initial value
v of type
t must be declared by:
g :: GVar t g = gvar v
Here, the type
t must not contain type variables.
v is the initial value for every program run.
Note: the implementation in PAKCS is based on threading a state through the execution. Thus, it might be the case that some updates of global variables are lost if fancy features like unsafe operations or debugging support are used.