From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.bugs Subject: bug#31311: 27.0; doc of `pcase' Date: Tue, 15 May 2018 16:37:15 +0200 Message-ID: <87tvr956jo.fsf@gnuvola.org> References: <83wowqrmp8.fsf@gnu.org> <87efixlv8g.fsf@web.de> <83muxlsvfm.fsf@gnu.org> <871sexlqvw.fsf@web.de> <83k1sps9n3.fsf@gnu.org> <87wowpndoo.fsf@gmail.com> <87fu3c6cm3.fsf@gnuvola.org> <83zi1kqynx.fsf@gnu.org> <871seh3yw8.fsf@gnuvola.org> <877eo9kmey.fsf@gmail.com> Reply-To: 31311@debbugs.gnu.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: blaine.gmane.org 1526394800 22586 195.159.176.226 (15 May 2018 14:33:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 15 May 2018 14:33:20 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Noam Postavsky To: 31311@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 15 16:33:16 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fIb0u-0005kh-1I for geb-bug-gnu-emacs@m.gmane.org; Tue, 15 May 2018 16:33:16 +0200 Original-Received: from localhost ([::1]:40979 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIb31-0001gG-3d for geb-bug-gnu-emacs@m.gmane.org; Tue, 15 May 2018 10:35:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIb2f-0001X8-JL for bug-gnu-emacs@gnu.org; Tue, 15 May 2018 10:35:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIb2c-0007z9-DY for bug-gnu-emacs@gnu.org; Tue, 15 May 2018 10:35:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56201) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fIb2c-0007yz-AM for bug-gnu-emacs@gnu.org; Tue, 15 May 2018 10:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fIb2c-0003OX-09 for bug-gnu-emacs@gnu.org; Tue, 15 May 2018 10:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thien-Thi Nguyen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 May 2018 14:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31311 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31311-submit@debbugs.gnu.org id=B31311.152639488713018 (code B ref 31311); Tue, 15 May 2018 14:35:01 +0000 Original-Received: (at 31311) by debbugs.gnu.org; 15 May 2018 14:34:47 +0000 Original-Received: from localhost ([127.0.0.1]:35863 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fIb2M-0003Np-NZ for submit@debbugs.gnu.org; Tue, 15 May 2018 10:34:46 -0400 Original-Received: from mail.agora-net.com ([67.59.132.6]:53974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fIb2L-0003Ng-JB for 31311@debbugs.gnu.org; Tue, 15 May 2018 10:34:45 -0400 Original-Received: from ttn by mail.agora-net.com with local (Exim 4.82) (envelope-from ) id 1fIb2K-0000jV-Um; Tue, 15 May 2018 10:34:45 -0400 Original-Received: from ttn by zigzag.favinet with local (Exim 4.80) (envelope-from ) id 1fIb4t-0000eH-Rx; Tue, 15 May 2018 16:37:23 +0200 Mail-Followup-To: 31311@debbugs.gnu.org In-Reply-To: <877eo9kmey.fsf@gmail.com> (Noam Postavsky's message of "Sat, 12 May 2018 09:56:21 -0400") X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: ttn@gnuvola.org X-SA-Exim-Scanned: No (on mail.agora-net.com); SAEximRunCond expanded to false 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: 208.118.235.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:146194 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable () Noam Postavsky () Sat, 12 May 2018 09:56:21 -0400 I would say the behaviour of pcase when guard expressions have side-effects is not defined, so the documentation should advise against having side-effects in guard expressions. I've done this (commit 977bd10f5e70) and extended the advice to other places where evaluation occurs. [=E2=80=98t=E2=80=99 and =E2=80=98nil=E2=80=99 as SYMBOL patterns] Thanks for confirming. I've addressed this in another post. > For anyone just joining, these commits are on the branch > =E2=80=98fix/bug-31311-pcase-doc=E2=80=99 (off of =E2=80=98emacs-26=E2= =80=99). Feedback on > anything there is most welcome! In the docstring, you have [...] two catagories [...] logical and structural. You grouped SYMBOL into the "logical patterns", but I don't think it really fits into either of those. Better to make it separate, perhaps? In the end, reverted this distinction, moved `QPAT material to the =E2=80=98(pcase-defmacro \` (qpat) ...)=E2=80=99 form, and added a comm= ent in =E2=80=98pcase--make-docstring=E2=80=99 proposing somehow to arrange for `QPAT docstring to be presented immediately after =E2=80=98pcase=E2=80=99. = More on this in a post to emacs-devel (which is still queued for delivery on my side at this moment...). I'm also not so sure it's a useful division. At least, they shouldn't be presented as equal categories. The "structural" is more a short form for particular kinds of "logical" patterns. For example, `(1 . 2) is equivalent to (and (pred consp) (app car 1) (app cdr 2)) True. However, i'm trying to avoid using `QPAT in either docstrings or examples prior to its introduction (including table of possible QPAT forms). Kind of an informational layering. This snippet was very useful, anyway; i adapted and expanded on it for the example illustrating "2nd SYMBOL becomes =E2=80=98eq=E2=80=99 test". Thanks for posting it. =2D-=20 Thien-Thi Nguyen ----------------------------------------------- (defun responsep (query) (pcase (context query) (`(technical ,ml) (correctp ml)) ...)) 748E A0E8 1CB8 A748 9BFA =2D-------------------------------------- 6CE4 6703 2224 4C80 7502 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlr68J0ACgkQZwMiJEyAdQLrOQCgoVpQ6LVtDNTOanPS4T9eQ1N9 YRIAoI1UjlKAWJAZqSE3Ov4iJ8+m2QFJ =FEBP -----END PGP SIGNATURE----- --=-=-=--