From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: hokomo Newsgroups: gmane.emacs.bugs Subject: bug#59887: pcase vs. pcase-let: Underscore in backquote-style patterns Date: Tue, 13 Dec 2022 02:19:22 +0100 Message-ID: <87lenc84df.fsf@airmail.cc> References: <87sfhrqgxw.fsf@airmail.cc> <87v8mhmj26.fsf@web.de> <87pmco8nyc.fsf@airmail.cc> <87edt42jaz.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27732"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.9; emacs 28.2 Cc: 59887-done@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 13 02:45:26 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 1p4uMH-0006zU-1U for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Dec 2022 02:45:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4uLz-0004mn-7Y; Mon, 12 Dec 2022 20:45: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 1p4uLv-0004lp-8q for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2022 20:45:04 -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 1p4uLu-0000LI-IN for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2022 20:45:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p4uLu-0000PW-5S for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2022 20:45:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: hokomo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Dec 2022 01:45:02 +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.16708958501553 (code D ref 59887); Tue, 13 Dec 2022 01:45:02 +0000 Original-Received: (at 59887-done) by debbugs.gnu.org; 13 Dec 2022 01:44:10 +0000 Original-Received: from localhost ([127.0.0.1]:57003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4uL3-0000Oz-Re for submit@debbugs.gnu.org; Mon, 12 Dec 2022 20:44:10 -0500 Original-Received: from [37.120.193.124] (port=60902 helo=mail.cock.li) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4uKz-0000OV-8k for 59887-done@debbugs.gnu.org; Mon, 12 Dec 2022 20:44:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=airmail.cc; s=mail; t=1670895838; bh=GUtLc+NnAsn8PIkg7VpFH38qoL4Zyr0i/piQlOFJKFo=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=dQJD7f5o6gpGrDMKNBKt04qk77KpkDZARKt1L85mbrkLIbPEeKAeJdDLWIHVHRHPG vsEhwWmfGoQbRjJOCL4E31ZUUL1AuveBhv21H13CHCyrQyUQGuwWS63R8kwFdf3XcP qzOB5bJzntMof00h1QHAkGRj1mDw3Iui3jqPRKYwwmi3UAkiAPJGJ2ALrdWJ/OnI54 JjX1143wLHO401WQYmLEbmlDEH3L9VTmBrmFGDA3t3oO71Mf3ucsPSc1Mdal4k7urw eyFA/jyVzmFj6asOETXjAMhKaxy0LEqJqtXXmVm7DGpyzUdb707uc84NRZW118h3/u WDCrEtdwsATUg== In-reply-to: <87edt42jaz.fsf@web.de> 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:250794 Archived-At: > That says: > > | The macros described in this section use =E2=80=98pcase=E2=80=99 pat= terns=20 > to perform > | destructuring binding. The condition of the object to be of=20 > compatible > | structure means that the object must match the pattern,=20 > because only > | then the object=E2=80=99s subfields can be extracted. For example: > | > | (pcase-let ((`(add ,x ,y) my-list)) > | (message "Contains %S and %S" x y)) > | > | does the same as the previous example, except that it directly=20 > tries to > | extract =E2=80=98x=E2=80=99 and =E2=80=98y=E2=80=99 from =E2=80=98my-li= st=E2=80=99 without first verifying if=20 > =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=20 > as its > | first element. The precise behavior when the object does not=20 > actually > | match the pattern is undefined, although the body will not be=20 > silently > | skipped: either an error is signaled or the body is run with=20 > 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=20 > notice > the implications when you first read it? I dunno, I'm not that=20 > good in > writing documentation, but I can't find something to add from=20 > what we > had discussed that would not be redundant. That indeed describes it nicely. Somehow I managed to miss that=20 whole paragraph and instead skipped directly to the documentation=20 string of pcase-let. My bad... :-) > Or should we maybe just warn about the possible pitfall a bit=20 > more > offensively? Hmm, I understand the concern about being redundant, especially=20 since all four of the listed functions have the same behavior, and=20 documenting it for one would mean documenting it for each one. Perhaps including a variation of the phrase "Each EXP should match=20 (i.e. be of compatible structure)" in each of the four=20 descriptions would hint at this behavior while not being overly=20 verbose? From that point the user can search for "compatible" on=20 the same page and immediately find a match in the text at the top=20 that explains the constraints. hokomo