Next: , Previous: Promises, Up: Top


13 Keyed Variables

A keyed variable is a device that associates a non-symbolic key (in the form of an accessor applicative) with a value depending on the context in which lookup occurs. Kernel provides two types of keyed variables: dynamic & static. Keyed Dynamic Variables use the dynamic extent as context and Keyed Static Variables use the dynamic environment.

13.1 Keyed Dynamic Variables

A keyed dynamic variable is a device that associates a non-symbolic key (in the form of an accessor applicative) with a value depending on the dynamic extent in which lookup occurs.

— Applicative: make-keyed-dynamic-variable (make-keyed-dynamic-variable)

Returns a list of the form (b a), where b and a are applicatives, as follows. Each call to make-keyed-dynamic-variable returns different b and a.

13.2 Keyed Static Variables

A keyed static variable is a device that binds data in an environment by a non-symbolic key, where the key is an accessor applicative.

— Applicative: make-keyed-static-variable (make-keyed-static-variable)

Returns a list of the form (b a), where b and a are applicatives, as follows. Each call to make-keyed-static-variable returns different b and a.