From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#59887: pcase vs. pcase-let: Underscore in backquote-style patterns Date: Tue, 13 Dec 2022 02:17:56 +0100 Message-ID: <87edt42jaz.fsf@web.de> References: <87sfhrqgxw.fsf@airmail.cc> <87v8mhmj26.fsf@web.de> <87pmco8nyc.fsf@airmail.cc> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23443"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 59887-done@debbugs.gnu.org To: hokomo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 13 02:19:24 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1p4tx5-0005rh-SB for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Dec 2022 02:19:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4twp-0006Js-QC; Mon, 12 Dec 2022 20:19:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p4twk-0006JS-0g for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2022 20:19:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4twj-0006ZG-P6 for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2022 20:19:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p4twj-00068J-Kf for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2022 20:19:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Dec 2022 01:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59887 X-GNU-PR-Package: emacs Original-Received: via spool by 59887-done@debbugs.gnu.org id=D59887.167089429323555 (code D ref 59887); Tue, 13 Dec 2022 01:19:01 +0000 Original-Received: (at 59887-done) by debbugs.gnu.org; 13 Dec 2022 01:18:13 +0000 Original-Received: from localhost ([127.0.0.1]:56825 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4tvw-00067r-H4 for submit@debbugs.gnu.org; Mon, 12 Dec 2022 20:18:12 -0500 Original-Received: from mout.web.de ([212.227.15.4]:60107) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4tvt-00067j-8g for 59887-done@debbugs.gnu.org; Mon, 12 Dec 2022 20:18:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1670894279; bh=sFI9NSIpiPpumwEFxh40lOBe5qW8e5Rn6i5PzBY7McA=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=VUXkEHibUA7SQzHeBFjqMpRjW6aBKuPOx6lhvPj94jKR6ZHX6p+52tCWMBdXF4Ixd E8OBbAf7LJYiemJ8CLSqzBMQtJNMgemjEsyRiY+SiSHApyOk9Hy/0eImtaa/Xw3Q8i rD7BOQh0kPLtjjAryzhfKpYs29+kOmu7eSscSRvIhZZAoMn7olwuECXaSSnpXyMZ0P AdthxGb/YCx3V8uSTh/NVTgTe8pKwgpIQ9kcclwmMQRAf8/IeA01xqfV0tPoejK8EO qdNbsGSwoihjEg3qcnF4Ui2J8rGoY081IZyDaayVNpXAHeg/SfvgZEZhDfkgJVbj8Y jH60wwB6nGdbA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from drachen.dragon ([92.76.229.140]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MW9ra-1pSVKv1drG-00XdTs; Tue, 13 Dec 2022 02:17:59 +0100 In-Reply-To: <87pmco8nyc.fsf@airmail.cc> (hokomo@airmail.cc's message of "Mon, 12 Dec 2022 19:26:28 +0100") X-Provags-ID: V03:K1:be11BG356nORjMjgdHZA72SKDzM15o2cwGahd9akdDxre9uEv5v Se0RdP2j6xy/c6juJkGaAZ3AvOSKSWP4VfkWZSsojjPrm/7+zAPHSIsyWqG6iuOKyUSrmRB nFjgq20SN/SZ5smDJOexHclNi9Jk7ZHkgCS4i/IqzYipjusckpNUG35yEeWdwZ1ASS/o2KH swapLfyMHyV4OnrAaPFvQ== UI-OutboundReport: notjunk:1;M01:P0:oN92XXmUDpc=;qAhNrZ3Ry1qeLiJdlEIN8xG6Wau Pj4gNIJDGZcdlK6qSP8nG0U9z9TUDRRvfZGxGWWsMifx6Rtyb/sc9mVtDlQZ7wmG/kVN6mrid OR0T6lAUQt0HdWwpoSuTluV9KnCyjFhcYlqrZenNKG8/RB6e4GCJ/GgSA89s/yCRGI83tCsZm Y7zy3pbYkedWhDKjaOYxY/evRNhYjvxxmqzg9pGORmHS3Jd7/oHqfSJbL2vluPbNiX/NoldEG zUMz8MZesyGpNsQgqEf3DvbZULfWZSk1pQbNr6lY/OiWHboC37Y6F2qhVOUauJeQi1dFftmb2 j+3kJtCpozWju6gIB+v2jXuRrnc+/QbVBRq0cBJFa94IRNjV9GKcHNdDRxwux+GzpJ8Mktm4u tSIRZ6JmHLpu10r2lGGuorXVewsSProfUEHbWSLhIPTnegmHE1cX4tEt/o2kEh3MBkH9SIDzc I4yZH12HwkmXXSmLd8IkrYJILGkj3B1T1JD4qIjdYf7z8ogh3eAxh0FITEcTJRlBgsLSN2Krd YxAZT1b52H0WQhkI/QGScW276vPdzgiUUyj6939AoIigzQX1BgRMSHfFVLSkqei0DfagcovQO UTpcrE+dEC9WsDdHeWlc5CM8eniOwTezNfBbofLK8gwGBYEC08iFIrgjsLZg79pWenkxfEZSb s2LJa/wgcfLewdkWrp8rZyfNCobYSzyw1d/UR55ONjFHuFHdiC1S3FbIUFBrxzvND4sGJsBf2 Auz6F7Dn/9Z8evdLzrpRRuTy+qafPjdL1MTESboEgy0VPdV/i/7eAGsSWpRK0bRXRXBj3GwT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:250788 Archived-At: hokomo writes: > Your quote above made everything clear, but I completely missed it > since I was reading the Emacs Lisp manual's explanation [1] rather > than pcase-let's docstring. Maybe it would be beneficial to include > the above quote in the manual as well. > That says: | The macros described in this section use =E2=80=98pcase=E2=80=99 patte= rns to perform | destructuring binding. The condition of the object to be of compatible | structure means that the object must match the pattern, because only | then the object=E2=80=99s subfields can be extracted. For example: |=20 | (pcase-let ((`(add ,x ,y) my-list)) | (message "Contains %S and %S" x y)) |=20 | does the same as the previous example, except that it directly tries to | extract =E2=80=98x=E2=80=99 and =E2=80=98y=E2=80=99 from =E2=80=98my-list= =E2=80=99 without first verifying if =E2=80=98my-list=E2=80=99 | is a list which has the right number of elements and has =E2=80=98add=E2= =80=99 as its | first element. The precise behavior when the object does not actually | match the pattern is undefined, although the body will not be silently | skipped: either an error is signaled or the body is run with some of the | variables potentially bound to arbitrary values like =E2=80=98nil=E2=80= =99. That explains the same thing quite broadly. Maybe you did not notice the implications when you first read it? I dunno, I'm not that good in writing documentation, but I can't find something to add from what we had discussed that would not be redundant. Or should we maybe just warn about the possible pitfall a bit more offensively? Michael.