Go to the first, previous, next, last section, table of contents.


Symbols

Muq symbols are modelled directly on those of Common Lisp, and serve essentially as global variables.

Internally, a symbol is much like a vector with one slot each for the name of the symbol, the value of the symbol when used as a variable, the value of the symbol when used as a function, a list of properties associated with the symbol, and the package to which the symbol belongs. See section Class Package.

Only the function and value slots are normally of interest to the muf programmer:

The "global variables" the muf programmer deals with, including names of functions, are in fact symbols.

In muf, mentioning the name of a symbol generates a call to the 'function' value of the symbol if it has one, else pushes the contents of its value slot on the stack. Preceding the symbol's name with a singleQuote pushes the symbol itself on the stack.

Thus, it is important to define a function before attempting to use it: doing otherwise will result in a load of the symbol's value rather than a call to it.

Symbols export the following properties:

$S.name     String naming object.
$S.function If symbol names a function, this holds the compiledFunction.
$S.package  If symbol is owned by a package, this points to that package.
$S.value    If symbol names a global variable, this holds the value.
$S.type     If symbol names a type, this holds the type.
$S.proplist A linklist of properties, as usual in Lisp.


Go to the first, previous, next, last section, table of contents.