Previous: Property Lists, Up: Symbols [Contents][Index]
These functions create unique symbols, typically for use as temporary variables.
This function creates a new, uninterned symbol (using make-symbol
)
with a unique name. (The name of an uninterned symbol is relevant
only if the symbol is printed.) By default, the name is generated
from an increasing sequence of numbers, ‘G1000’, ‘G1001’,
‘G1002’, etc. If the optional argument x is a string, that
string is used as a prefix instead of ‘G’. Uninterned symbols
are used in macro expansions for temporary variables, to ensure that
their names will not conflict with “real” variables in the user’s
code.
This variable holds the counter used to generate gensym
names.
It is incremented after each use by gensym
. In Common Lisp
this is initialized with 0, but this package initializes it with a
random (time-dependent) value to avoid trouble when two files that
each used gensym
in their compilation are loaded together.
XEmacs note: As of XEmacs 21.0, an uninterned symbol remains uninterned even after being dumped to bytecode. Older versions of Emacs didn’t distinguish the printed representation of interned and uninterned symbols, so their names had to be treated more carefully.
This function is like gensym
, except that it produces a new
interned symbol. If the symbol that is generated already
exists, the function keeps incrementing the counter and trying
again until a new symbol is generated.
The Quiroz cl.el package also defined a defkeyword
form for creating self-quoting keyword symbols. This package
automatically creates all keywords that are called for by
&key
argument specifiers, and discourages the use of
keywords as data unrelated to keyword arguments, so the
defkeyword
form has been discontinued.
Previous: Property Lists, Up: Symbols [Contents][Index]