From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: Are two symbols `equal' iff they are `eq'? Date: Sun, 09 Aug 2015 09:42:29 +0200 Message-ID: <878u9k7vru.fsf@mbork.pl> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1439106190 22105 80.91.229.3 (9 Aug 2015 07:43:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 9 Aug 2015 07:43:10 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Aug 09 09:43:03 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZOLG2-0006C3-Gk for geh-help-gnu-emacs@m.gmane.org; Sun, 09 Aug 2015 09:43:02 +0200 Original-Received: from localhost ([::1]:54562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOLG1-00057s-I4 for geh-help-gnu-emacs@m.gmane.org; Sun, 09 Aug 2015 03:43:01 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOLFk-00054i-QM for help-gnu-emacs@gnu.org; Sun, 09 Aug 2015 03:42:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZOLFh-0006EX-Kk for help-gnu-emacs@gnu.org; Sun, 09 Aug 2015 03:42:44 -0400 Original-Received: from mail.mojserwer.eu ([2a01:5e00:2:52::8]:57959) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOLFh-0006ET-Cq for help-gnu-emacs@gnu.org; Sun, 09 Aug 2015 03:42:41 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id B82D86F2004 for ; Sun, 9 Aug 2015 09:42:39 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GRftRn7SqeoV for ; Sun, 9 Aug 2015 09:42:37 +0200 (CEST) Original-Received: from localhost (unknown [109.232.24.146]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 434346F2003 for ; Sun, 9 Aug 2015 09:42:37 +0200 (CEST) In-reply-to: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a01:5e00:2:52::8 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106383 Archived-At: On 2015-08-09, at 02:31, Joost Kremers wrote: > Marcin Borkowski wrote: >> 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.) > > Quoting the description of `equal` in the Elips manual: > > ,---- > | -- Function: equal object1 object2 > | This function returns `t' if OBJECT1 and OBJECT2 have equal > | components, and `nil' otherwise. Whereas `eq' tests if its > | arguments are the same object, `equal' looks inside nonidentical > | arguments to see if their elements or contents are the same. So, > | if two objects are `eq', they are `equal', but the converse is not > | always true. > `---- > > (info "(elisp) Equality Predicates") > > Seems to me to be very clear: objects can be `equal` without being `eq`. > (But they cannot be `eq` if they're not `equal`.) Of course. But what about symbols? I cannot make two symbols which would be `equal' but not `eq'. (This doesn't mean that it's impossible, though - only that I don't know how to do it, if it's possible.) I tried same-named symbols in different obarrays, a mic of uninterned and interned symbols, and two uninterned symbols with the same name. So I strongly suspect that `eq' and `equal' for symbols are the same. I even did something as contrived as (defun eq (a b) (message "Haha!)) (equal 'a 'a) Of course, it only showed that `equal' does not /call/ `eq' for symbols, but it's still not a definitive answer. (Note to purists: I did it in a separate instance of Emacs, and immediately killed that instance, so that I didn't accidentally open a portal to a world full of terrible monsters or something like that.) Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University