From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: emacs-27 eebfb72 1/2: Document constant vs mutable objects better Date: Sat, 2 May 2020 14:08:21 -0700 Organization: UCLA Computer Science Department Message-ID: <8d7d73a2-e0c2-c43f-1125-534493752c91@cs.ucla.edu> References: <20200418200112.26900.1274@vcs0.savannah.gnu.org> <20200418200114.85C8C20A2B@vcs0.savannah.gnu.org> <87wo6c5vxf.fsf@gmail.com> <54e69de3-f1b9-cbcc-dec1-11f5b1bcd481@cs.ucla.edu> <87o8rn3y2k.fsf@gmail.com> <20200418200112.26900.1274@vcs0.savannah.gnu.org> <20200418200114.85C8C20A2B@vcs0.savannah.gnu.org> <87wo6c5vxf.fsf@gmail.com> <54e69de3-f1b9-cbcc-dec1-11f5b1bcd481@cs.ucla.edu> <87o8rn3y2k.fsf@gmail.com> <20200418200112.26900.1274@vcs0.savannah.gnu.org> <20200418200114.85C8C20A2B@vcs0.savannah.gnu.org> <87wo6c5vxf.fsf@gmail.com> <54e69de3-f1b9-cbcc-dec1-11f5b1bcd481@cs.ucla.edu> <87o8rn3y2k.fsf@gmail.com> <87k12a4gm1.fsf@gmail.com> <871ro24i1p.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020AC6B9718CBC947B09567E" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="585"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Cc: Michael Heerdegen , emacs-devel@gnu.org To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 02 23:09:44 2020 Return-path: Envelope-to: ged-emacs-devel@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 1jUzOJ-000Y3i-W8 for ged-emacs-devel@m.gmane-mx.org; Sat, 02 May 2020 23:09:44 +0200 Original-Received: from localhost ([::1]:59358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUzOJ-00061q-3A for ged-emacs-devel@m.gmane-mx.org; Sat, 02 May 2020 17:09:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUzNC-0005Br-M7 for emacs-devel@gnu.org; Sat, 02 May 2020 17:08:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUzNB-0000Hu-2X for emacs-devel@gnu.org; Sat, 02 May 2020 17:08:33 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:58878) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUzNA-0000GP-G3 for emacs-devel@gnu.org; Sat, 02 May 2020 17:08:32 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 41D0D1600E4; Sat, 2 May 2020 14:08:29 -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 3cP-TWfaX93V; Sat, 2 May 2020 14:08:27 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 95E241600E5; Sat, 2 May 2020 14:08:27 -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 M8_y9SJ2N4Ej; Sat, 2 May 2020 14:08:27 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 5F14C1600E4; Sat, 2 May 2020 14:08:27 -0700 (PDT) Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkV5QWNtUUJFQURB QXlIMnhvVHU3cHBHNUQzYThGTVpFb243NGRDdmM0K3ExWEEySjJ0QnkycHdhVHFmCmhweHhk R0E5Smo1MFVKM1BENGJTVUVnTjh0TFowc2FuNDdsNVhUQUZMaTI0NTZjaVNsNW04c0thSGxH ZHQ5WG0KQUF0bVhxZVpWSVlYL1VGUzk2ZkR6ZjR4aEVtbS95N0xiWUVQUWRVZHh1NDd4QTVL aFRZcDVibHRGM1dZRHoxWQpnZDdneDA3QXV3cDdpdzdlTnZub0RUQWxLQWw4S1lEWnpiRE5D UUdFYnBZM2VmWkl2UGRlSStGV1FONFcra2doCnkrUDZhdTZQcklJaFlyYWV1YTdYRGRiMkxT MWVuM1NzbUUzUWpxZlJxSS9BMnVlOEpNd3N2WGUvV0szOEV6czYKeDc0aVRhcUkzQUZINmls QWhEcXBNbmQvbXNTRVNORnQ3NkRpTzFaS1FNcjlhbVZQa25qZlBtSklTcWRoZ0IxRApsRWR3 MzRzUk9mNlY4bVp3MHhmcVQ2UEtFNDZMY0ZlZnpzMGtiZzRHT1JmOHZqRzJTZjF0azVlVThN Qml5Ti9iClowM2JLTmpOWU1wT0REUVF3dVA4NGtZTGtYMndCeHhNQWhCeHdiRFZadWR6eERa SjFDMlZYdWpDT0pWeHEya2wKakJNOUVUWXVVR3FkNzVBVzJMWHJMdzYrTXVJc0hGQVlBZ1Jy NytLY3dEZ0JBZndoU In-Reply-To: <871ro24i1p.fsf@gmail.com> Content-Language: en-US Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/02 15:35:56 X-ACL-Warn: Detected OS = Linux 3.1-3.10 X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:248570 Archived-At: This is a multi-part message in MIME format. --------------020AC6B9718CBC947B09567E Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 5/2/20 5:50 AM, =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec wrote: > I meant the list examples you changed: you would never actually use >=20 > (memq (list 2) '((1) (2))) >=20 > instead of (memq '(2) '((1) (2))), same as you'd never use > `copy-sequence' to make sure you have a fresh comparison key. >=20 > Rather, the point of that section is to use `member' instead of `memq', > analogously to `assoc' vs `assq' above. I see your point. That's easy enough to fix; I installed the attached pat= ch. > if you introduce wording > such as "the other arguments (all but the last) should be mutable > lists", that (to me, and I'm sure many other readers) implies that you > are talking about (types of) data structures, i.e. that there is such a > thing as mutable (and also immutable, because why would you use that > term otherwise?) lists/conses/strings as opposed to something else, as > there indeed is in some languages, including Scheme (e.g. SRFI 140) or > Racket. That's OK. It's not a misimpression to think of things that way. True, Sc= heme SRFI 140 has a lot more detail, with functions like istring? that Elisp l= acks, but the core idea is close enough and it would be nice if Elisp eventuall= y grew in the same direction as Scheme in this area (though obviously this would= be a much bigger project than merely fiddling with the documentation). I just checked, and Scheme has gone in the Elisp direction recently in th= is area: although R6RS took the strong position that safety is essential, R7= RS says it's not - e.g., R7RS like R5RS says that (car 0) can cause the interpret= er to crash (though of course interpreters are suggested to behave more nicely = than that). This change to the Scheme spec was for performance reasons that El= isp is not immune to. --------------020AC6B9718CBC947B09567E Content-Type: text/x-patch; charset=UTF-8; name="0001-Make-memq-etc.-examples-more-like-they-were.patch" Content-Disposition: attachment; filename="0001-Make-memq-etc.-examples-more-like-they-were.patch" Content-Transfer-Encoding: quoted-printable >From 0a3731feef351f6af47bed1458aefb6cb481b5f9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 2 May 2020 13:48:21 -0700 Subject: [PATCH] Make memq etc. examples more like they were MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Problem reported by =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec in: https://lists.gnu.org/r/emacs-devel/2020-05/msg00130.html * doc/lispref/lists.texi (Sets And Lists, Association Lists): Revert examples to be more like the way they were, using self-evaluating expressions. Be more consistent about listing unspecified results. --- doc/lispref/lists.texi | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index ea44e01f48..fcaf4386b1 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1242,8 +1242,8 @@ compare @var{object} against the elements of the li= st. For example: @result{} (b c b a) @end group @group -(memq '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are not @code{e= q}.} - @result{} nil +(memq '(2) '((1) (2))) ; @r{The two @code{(2)}s need not be @code{eq}= .} + @result{} @r{Unspecified; might be @code{nil} or @code{((2))}.} @end group @end example @end defun @@ -1356,12 +1356,12 @@ Compare this with @code{memq}: =20 @example @group -(memql 1.2 '(1.1 1.2 1.3)) ; @r{@code{1.2} and @code{1.2} must be @code= {eql}.} +(memql 1.2 '(1.1 1.2 1.3)) ; @r{@code{1.2} and @code{1.2} are @code{eql= }.} @result{} (1.2 1.3) @end group @group -(memq 1.2 '(1.1 1.2 1.3)) ; @r{@code{1.2} and @code{1.2} need not be @c= ode{eq}.} - @result{} nil ; @r{... or it might be @code{(1.2 1.3)}.} +(memq 1.2 '(1.1 1.2 1.3)) ; @r{The two @code{1.2}s need not be @code{eq= }.} + @result{} @r{Unspecified; might be @code{nil} or @code{(1.2 1.3)}.} @end group @end example @end defun @@ -1380,12 +1380,12 @@ Compare this with @code{memq}: =20 @example @group -(member (list 2) '((1) (2))) ; @r{@code{(list 2)} and @code{(2)} are @c= ode{equal}.} +(member '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are @code{equal= }.} @result{} ((2)) @end group @group -(memq (list 2) '((1) (2))) ; @r{@code{(list 2)} and @code{(2)} are no= t @code{eq}.} - @result{} nil +(memq '(2) '((1) (2))) ; @r{The two @code{(2)}s need not be @code{eq}= .} + @result{} @r{Unspecified; might be @code{nil} or @code{(2)}.} @end group @group ;; @r{Two strings with the same contents are @code{equal}.} @@ -1626,7 +1626,7 @@ keys may not be symbols: ("compound leaves" . horsechestnut))) =20 (assq "simple leaves" leaves) - @result{} @r{Unspecified; might be @code{nil} or non-@code{nil}.} + @result{} @r{Unspecified; might be @code{nil} or @code{("simple lea= ves" . oak)}.} (assoc "simple leaves" leaves) @result{} ("simple leaves" . oak) @end smallexample --=20 2.17.1 --------------020AC6B9718CBC947B09567E--