From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: David Kastrup Newsgroups: gmane.lisp.guile.bugs Subject: bug#41354: equal? has no sensible code path for symbols Date: Wed, 27 May 2020 22:49:10 +0200 Message-ID: <87o8q9cddl.fsf@fencepost.gnu.org> References: <87v9kuzvht.fsf@fencepost.gnu.org> <875zchjen4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="88328"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 41354@debbugs.gnu.org To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Wed May 27 22:50:07 2020 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1je303-000Mrt-LL for guile-bugs@m.gmane-mx.org; Wed, 27 May 2020 22:50:07 +0200 Original-Received: from localhost ([::1]:34792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1je302-0000cO-67 for guile-bugs@m.gmane-mx.org; Wed, 27 May 2020 16:50:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1je2zy-0000Zj-KW for bug-guile@gnu.org; Wed, 27 May 2020 16:50:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1je2zy-00060v-Ad for bug-guile@gnu.org; Wed, 27 May 2020 16:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1je2zy-0004xD-3m for bug-guile@gnu.org; Wed, 27 May 2020 16:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Kastrup Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 27 May 2020 20:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41354 X-GNU-PR-Package: guile Original-Received: via spool by 41354-submit@debbugs.gnu.org id=B41354.159061256218992 (code B ref 41354); Wed, 27 May 2020 20:50:02 +0000 Original-Received: (at 41354) by debbugs.gnu.org; 27 May 2020 20:49:22 +0000 Original-Received: from localhost ([127.0.0.1]:50091 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1je2zJ-0004wG-Kv for submit@debbugs.gnu.org; Wed, 27 May 2020 16:49:21 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1je2zI-0004w4-Eg for 41354@debbugs.gnu.org; Wed, 27 May 2020 16:49:20 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:45092) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1je2zB-0005m2-EP; Wed, 27 May 2020 16:49:14 -0400 Original-Received: from x5d85576d.dyn.telefonica.de ([93.133.87.109]:33288 helo=lola) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1je2zA-0002bD-Rg; Wed, 27 May 2020 16:49:13 -0400 In-Reply-To: <875zchjen4.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Wed, 27 May 2020 22:39:59 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:9782 Archived-At: Ludovic Court=C3=A8s writes: > Hi David, > > David Kastrup skribis: > >> In Scheme, symbols can be compared using eq? for equality. However, >> since they have garbage-collected content attached, they do not meet the >> predicate SCM_IMP in the short-circuit evaluation at the start of equal? >> This means that unequal symbols compared using equal? fall through a >> whole bunch of tests and end up in a general structural comparison >> comparing their underlying string names. > > =E2=80=98equal?=E2=80=99 starts by checking for eq-ness, which LGTM: > > SCM > scm_equal_p (SCM x, SCM y) > #define FUNC_NAME s_scm_i_equal_p > { > SCM_CHECK_STACK; > tailrecurse: > SCM_TICK; > if (scm_is_eq (x, y)) > return SCM_BOOL_T; > > Or were you referring to something else? I repeat: "This means that UNEQUAL symbols compared using equal? fall through a whole bunch of tests and end up in a general structural comparison comparing their underlying string names". Lots of searches _end_ with an equal comparison (which is fast) but do a lot of unequal comparisons before that (which is slow, even though symbols that are not eq? will also not be equal?, so if you know you are checking _symbols_, if they are not eq? you are done). Symbols comparing as _unequal_ have no special path in equal?. --=20 David Kastrup