From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#36407: 27.0.50; `plist-get', `equal' etc. and circular "lists" Date: Thu, 27 Jun 2019 15:51:37 -0700 Organization: UCLA Computer Science Department Message-ID: <730806fc-5899-9bd0-81fd-42900406e874@cs.ucla.edu> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------142808C30346A01C011A655E" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="209492"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 Cc: 36407@debbugs.gnu.org To: Pip Cet Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 28 00:52:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hgdFT-000sLn-Lz for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Jun 2019 00:52:11 +0200 Original-Received: from localhost ([::1]:55150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgdFS-0003Ds-K3 for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Jun 2019 18:52:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47965) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgdFM-0003DU-2n for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2019 18:52:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgdFK-0005vV-5B for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2019 18:52:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54703) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hgdFJ-0005vN-W1 for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2019 18:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hgdFJ-0001rR-SU for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2019 18:52:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Jun 2019 22:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36407 X-GNU-PR-Package: emacs Original-Received: via spool by 36407-submit@debbugs.gnu.org id=B36407.15616759117137 (code B ref 36407); Thu, 27 Jun 2019 22:52:01 +0000 Original-Received: (at 36407) by debbugs.gnu.org; 27 Jun 2019 22:51:51 +0000 Original-Received: from localhost ([127.0.0.1]:40014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hgdF9-0001r3-5X for submit@debbugs.gnu.org; Thu, 27 Jun 2019 18:51:51 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:37228) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hgdF3-0001qm-Si for 36407@debbugs.gnu.org; Thu, 27 Jun 2019 18:51:46 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A8396161BDC; Thu, 27 Jun 2019 15:51:39 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id yayB80Z2nG6V; Thu, 27 Jun 2019 15:51:38 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 77216161C02; Thu, 27 Jun 2019 15:51:38 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id F_3i3ODbhgbC; Thu, 27 Jun 2019 15:51:38 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 29B5F161BDC; Thu, 27 Jun 2019 15:51:38 -0700 (PDT) Openpgp: preference=signencrypt Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= xsFNBEyAcmQBEADAAyH2xoTu7ppG5D3a8FMZEon74dCvc4+q1XA2J2tBy2pwaTqfhpxxdGA9 Jj50UJ3PD4bSUEgN8tLZ0san47l5XTAFLi2456ciSl5m8sKaHlGdt9XmAAtmXqeZVIYX/UFS 96fDzf4xhEmm/y7LbYEPQdUdxu47xA5KhTYp5bltF3WYDz1Ygd7gx07Auwp7iw7eNvnoDTAl KAl8KYDZzbDNCQGEbpY3efZIvPdeI+FWQN4W+kghy+P6au6PrIIhYraeua7XDdb2LS1en3Ss mE3QjqfRqI/A2ue8JMwsvXe/WK38Ezs6x74iTaqI3AFH6ilAhDqpMnd/msSESNFt76DiO1ZK QMr9amVPknjfPmJISqdhgB1DlEdw34sROf6V8mZw0xfqT6PKE46LcFefzs0kbg4GORf8vjG2 Sf1tk5eU8MBiyN/bZ03bKNjNYMpODDQQwuP84kYLkX2wBxxMAhBxwbDVZudzxDZJ1C2VXujC OJVxq2kljBM9ETYuUGqd75AW2LXrLw6+MuIsHFAYAgRr7+KcwDgBAfwhPBYX34nSSiHlmLC+ KaHLeCLF5ZI2vKm3HEeCTtlOg7xZEONgwzL+fdKo+D6SoC8RRxJKs8a3sVfI4t6CnrQzvJbB n6gxdgCu5i29J1QCYrCYvql2UyFPAK+do99/1jOXT4m2836j1wARAQABzSBQYXVsIEVnZ2Vy dCA8ZWdnZXJ0QGNzLnVjbGEuZWR1PsLBfgQTAQIAKAUCTIByZAIbAwUJEswDAAYLCQgHAwIG FQgCCQoLBBYCAwECH Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:161667 Archived-At: This is a multi-part message in MIME format. --------------142808C30346A01C011A655E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > I don't understand why the last two lines are there. I thought those lines were needed to avoid an infinite loop in pathological cyclic cases. But on further thought you're right, they aren't needed. I installed that patch; thanks. > shouldn't `equal' be symmetric? Yes, on its domain. But circular lists are outside its domain, and the documentation doesn't promise any particular behavior on them. It's OK if (equal a b) signals an error and (equal b a) does not. It's even OK if (equal a b) signals an error and a later call (equal a b) with exactly the same (unchanged) arguments does not (because the stack happens to have more room the second time). We still have symmetry in the sense that (eq (equal a b) (equal b a)) always either returns t or signals an error; it never returns nil. I installed the attached doc patch to try to make this a bit clearer. --------------142808C30346A01C011A655E Content-Type: text/x-patch; name="0001-Improve-equal-and-array-doc.patch" Content-Disposition: attachment; filename="0001-Improve-equal-and-array-doc.patch" Content-Transfer-Encoding: quoted-printable >From bdbb390ffef9f8b4eab263055723b27edad7b91c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 27 Jun 2019 15:39:04 -0700 Subject: [PATCH] =3D?UTF-8?q?Improve=3D20=3DE2=3D80=3D98equal=3DE2=3D80=3D= 99=3D20and=3D20array?=3D =3D?UTF-8?q?=3D20doc?=3D MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * doc/lispref/objects.texi (Array Type): Array sizes are nonnegative fixnums, not arbitrary integers. (Equality Predicates): Do not say that =E2=80=98eq=E2=80=99 equals =E2=80= =98=3D=E2=80=99 on bignums. Do not imply that =E2=80=98equal=E2=80=99 must signal an error on circula= r lists. --- doc/lispref/objects.texi | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 745baacc29..2e8e2ee714 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -964,7 +964,8 @@ Array Type =20 A string is an array of characters and a vector is an array of arbitrary objects. A bool-vector can hold only @code{t} or @code{nil}. -These kinds of array may have any length up to the largest integer. +These kinds of array may have any length up to the largest fixnum, +subject to system architecture limits and available memory. Char-tables are sparse arrays indexed by any valid character code; they can hold arbitrary objects. =20 @@ -2085,7 +2086,7 @@ Equality Predicates This function returns @code{t} if @var{object1} and @var{object2} are the same object, and @code{nil} otherwise. =20 -If @var{object1} and @var{object2} are integers with the same value, +If @var{object1} and @var{object2} are fixnums with the same value, they are considered to be the same object (i.e., @code{eq} returns @code{t}). If @var{object1} and @var{object2} are symbols with the same name, they are normally the same object---but see @ref{Creating @@ -2095,7 +2096,7 @@ Equality Predicates are the same object, meaning that a change in the contents of one will be reflected by the same change in the contents of the other. For other types of objects whose contents cannot be changed (e.g., -floats), two arguments with the same contents might or might not be +bignums and floats), two arguments with the same contents might or might= not be the same object, and @code{eq} returns @code{t} or @code{nil} depending on whether the Lisp interpreter created one object or two. =20 @@ -2258,7 +2259,7 @@ Equality Predicates their textual contents are the same. @end defun =20 - The test for equality is implemented recursively; for example, given + For @code{equal}, equality is defined recursively; for example, given two cons cells @var{x} and @var{y}, @code{(equal @var{x} @var{y})} returns @code{t} if and only if both the expressions below return @code{t}: @@ -2268,8 +2269,10 @@ Equality Predicates (equal (cdr @var{x}) (cdr @var{y})) @end example =20 -Because of this recursive method, circular lists may therefore cause -infinite recursion (leading to an error). +Comparing circular lists may therefore cause deep recursion that leads +to an error, and this may result in counterintuitive behavior such as +@code{(equal a b)} returning @code{t} whereas @code{(equal b a)} +signals an error. =20 @defun equal-including-properties object1 object2 This function behaves like @code{equal} in all cases but also requires --=20 2.21.0 --------------142808C30346A01C011A655E--