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: Mon, 12 Dec 2022 19:26:28 +0100 Message-ID: <87pmco8nyc.fsf@airmail.cc> References: <87sfhrqgxw.fsf@airmail.cc> <87v8mhmj26.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9145"; 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 Mon Dec 12 19:42:20 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 1p4nko-00028a-M0 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Dec 2022 19:42:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4nkc-0003e4-2f; Mon, 12 Dec 2022 13:42:06 -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 1p4nkY-0003dW-EB for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2022 13:42:03 -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 1p4nkY-0002S6-1X for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2022 13:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p4nkX-0002J9-NV for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2022 13:42:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: hokomo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Dec 2022 18:42: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.16708704748843 (code D ref 59887); Mon, 12 Dec 2022 18:42:01 +0000 Original-Received: (at 59887-done) by debbugs.gnu.org; 12 Dec 2022 18:41:14 +0000 Original-Received: from localhost ([127.0.0.1]:54641 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4njl-0002IZ-Ko for submit@debbugs.gnu.org; Mon, 12 Dec 2022 13:41:13 -0500 Original-Received: from [37.120.193.124] (port=60274 helo=mail.cock.li) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4njg-0002IR-RF for 59887-done@debbugs.gnu.org; Mon, 12 Dec 2022 13:41:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=airmail.cc; s=mail; t=1670870461; bh=8Uhp969u6iGVX4pdcqAdTSWQ4e+sz6+05NJ9fehD65g=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=L4s2NHAg+mr1Q2krNzG3FhO2KRaH+BOdy5Iu2vuFq79hP0uGdcuzgP6Kiwbz9WHIx KDd/BYM8ETOVH4h5UleUfM2E+XedBXvzGotZrYxBTgex/fFpTQ9WEyusjhWI9izg1M 76hwE7dXHu2NqkP2ee+1TLdcWyYvJ/UX1ynZ6km89i/rAOijUVmlx2TgfuLhCL/BBA I4VxQuiKc1Of6omaCu/AsFyk2dD/KPH3/UWTg2EINa5O5s1TJ0MlexWOcbPb+sSslW 2tTQXMm7ac1EECtj7rBPZYK8qmhkKOypH01DjkyAvbd3HCYau7Ug/Ngmd3AqQ+AuM6 6ra3tkf2YejRQ== In-reply-to: <87v8mhmj26.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:250743 Archived-At: > Note this part of the `pcase-let' documentation string: > > | Each EXP should match (i.e. be of compatible structure) to its > | respective PATTERN; a mismatch may signal an error or may go > | undetected, binding variables to arbitrary values, such as > nil. > > Your first case is invalid because the pattern doesn't match the > value. > Here it goes undetected and bindings get established. I see! That clarifies the behavior I was seeing. > This behavior is not perfect, but AFAIR it has been preferred > over the > less efficient code that better checks would mean. So it's the > programmer's task to use only matching patterns. This is not > really a > restriction because `pcase-let' is intended to create bindings, > not for > testing whether a pattern matches some value. I suppose that's a fair tradeoff. > This idea had been discussed in the past. It had some votes but > it had > been decided not to implement such a feature because it would > not really > fit into the existing semantics, just for the sake of leaving > out one > ",". So I'm afraid I don't think we will change this. Right, it doesn't seem like such a huge win now that I understand that the behavior of pcase-let was according to its specification and there was no inconsistency to begin with. It would maybe make the code a little bit easier to read in certain cases, but I can see your point. > I think the current behavior can be understood and explained > from the > documentation quite well. If you can point to something > concrete > missing, please elaborate, and we can reopen this report. 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. [1] Thanks! hokomo