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

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

RE: Are two symbols `equal' iff they are `eq'?


From: Drew Adams
Subject: RE: Are two symbols `equal' iff they are `eq'?
Date: Sun, 9 Aug 2015 08:28:48 -0700 (PDT)

> As in the subject; neither the manual nor the docstring for `equal'
> are very clear on this.  (The docstring for `equal' says: "Symbols must
> match exactly.", which -- I would guess -- means `eq', but I'm not
> sure.)

Yes.  `equal' requires symbols to have the same name, value,
function definition, and plist, and to be interned in the same
obarray.  They need to be the same Lisp object (a symbol).

In sum: they need to be `eq'.

Emacs Lisp doesn't have a spec (just its code, and some doc).
But this is what the Common Lisp spec says about `equal' for
symbols:

 Returns true if x and y are structurally similar (isomorphic)
 objects.  Objects are treated as follows by equal.

 * Symbols, Numbers, and Characters
   equal is true of two objects if they are symbols that are eq,
                                            ^^^^^^^^^^^^^^^^^^^
   if they are numbers that are eql, or if they are characters
   that are eql.



reply via email to

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