help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: Calling a function with undefined symbol


From: Drew Adams
Subject: RE: [External] : Re: Calling a function with undefined symbol
Date: Mon, 31 Oct 2022 17:00:32 +0000

> > The Lisp manual says that a symbol is an object with a name.
>  
> This can be interpreted as the correct definition, but also as a wrong
> definition where a symbol is necessarily associated with a defined
> variable. Better said: a symbol is an object that represents a name.

Not really.  A symbol can "represent" any number of
things, (including a name, or multiple names - of
anything) - whatever you like.  But a symbol normally
_has_ a name, as one of its properties.


OP:

Function `make-symbol' requires a name, to create a
symbol.  Function `symbol-name' returns the name of
a symbol.

A symbol is indeed a Lisp object - an atom that has
a name and possibly other properties (value as a
variable, function definition,...).

The very first sentence of the Elisp chapter about
Symbols says this:

   A “symbol” is an object with a unique name.

And node Symbol Components tells you this:

   The print name cell _always_ holds a string, and
   cannot be changed.

   The print name cell holds the string that is the
   name of a symbol.  Since symbols are represented
   textually by their names, it is important not to
   have two symbols with the same name.[*]

Node Creating and Interning Symbols tells you:

   When the Lisp reader encounters a symbol, it reads
   all the characters of the name....  If a symbol
   with the desired name is found, the reader uses
   that symbol.  If the obarray does not contain a
   symbol with that name, the reader makes a new
   symbol and adds it to the obarray.

On the other hand, it is possible, but unusual, for
a symbol to be unnamed, aka "uninterned".  But you
need not worry about this unusual situation when
starting to learn about Lisp.  You should instead
think of a symbol as a Lisp object that _has a name_
(and possibly other properties).  (Node Creating
and Interning Symbols also tells you about
uninterned symbols.)

___

Yes, _read the manual_.  You read a bit about symbols
-- good.  Read that bit again.  And again.  It isn't
rocket science, and lots of effort has gone into
trying to explain things.  Read an introduction to
any Lisp - all Lisps have symbols.  And try the
functions involving symbols.

Read the Intro to Elisp manual that comes with Emacs.
___

[*] More precisely, there cannot be two symbols with
the same name _in the same obarray_.  An obarray is
essentially a symbol namespace.  Each obarray can
have a symbol with any name (that's unique in that
obarray).  Multiple obarrays can each have a symbol
`foo', that is, a symbol named "foo".  But those are
separate, independent symbols, not the same Lisp
object.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]