chickadee » mdh » global

global GLOBALprocedure

Allocates a an object representing a global persistent variable. The object should be freed using global-free when it is no longer required. There may be multiple references to the same global variable at the same time in existance. GLOBAL may be a string, symbol or number and will be converted to a string. The result of global is a wrapper procedure, invoking it with a (possibly empty) set of indices creates a reference to a specific location than can be further accessed and queried.

(define g (global "foo"))

(global-set! (g) 123)
(global-ref (g)) => "123"

Indices for as many as 10 dimensions may be given:

(global-set! (g 1 2) "xxx")
(global-ref (g 1 2)) => "xxx"