(lispref.info)Symbol Type


Next: Lisp Function Type Prev: Vector Type Up: Programming Types

Symbol Type
-----------

   A "symbol" in GNU Emacs Lisp is an object with a name.  The symbol
name serves as the printed representation of the symbol.  In ordinary
use, the name is unique--no two symbols have the same name.

   A symbol may be used in programs as a variable, as a function name,
or to hold a list of properties.  Or it may serve only to be distinct
from all other Lisp objects, so that its presence in a data structure
may be recognized reliably.  In a given context, usually only one of
these uses is intended.

   A symbol name can contain any characters whatever.  Most symbol names
are written with letters, digits, and the punctuation characters
`-+=*/'.  Such names require no special punctuation; the characters of
the name suffice as long as the name does not look like a number.  (If
it does, write a `\' at the beginning of the name to force
interpretation as a symbol.)  The characters `_~!@$%^&:<>{}' are less
often used but also require no special punctuation.  Any other
characters may be included in a symbol's name by escaping them with a
backslash.  In contrast to its use in strings, however, a backslash in
the name of a symbol quotes the single character that follows the
backslash, without conversion.  For example, in a string, `\t'
represents a tab character; in the name of a symbol, however, `\t'
merely quotes the letter `t'.  To have a symbol with a tab character in
its name, you must actually type an tab (preceded with a backslash).
But you would hardly ever do such a thing.

     Common Lisp note: in Common Lisp, lower case letters are always
     "folded" to upper case, unless they are explicitly escaped.  This
     is in contrast to Emacs Lisp, in which upper case and lower case
     letters are distinct.

   Here are several examples of symbol names.  Note that the `+' in the
fifth example is escaped to prevent it from being read as a number.
This is not necessary in the last example because the rest of the name
makes it invalid as a number.

     foo                 ; A symbol named `foo'.
     FOO                 ; A symbol named `FOO', different from `foo'.
     char-to-string      ; A symbol named `char-to-string'.
     1+                  ; A symbol named `1+'
                         ;   (not `+1', which is an integer).
     \+1                 ; A symbol named `+1'
                         ;   (not a very readable name).
     \(*\ 1\ 2\)         ; A symbol named `(* 1 2)' (a worse name).
     +-*/_~!@$%^&=:<>{}  ; A symbol named `+-*/_~!@$%^&=:<>{}'.
                         ;   These characters need not be escaped.


automatically generated by info2www