From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72328: [PATCH] Nested backquote in pcase Date: Mon, 29 Jul 2024 18:03:59 +0200 Message-ID: <877cd4rxqo.fsf@web.de> References: <87jzh62vtr.fsf@gmail.com> <877cd5k1ra.fsf@web.de> <871q3d347e.fsf@gmail.com> Reply-To: Michael Heerdegen Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28652"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 72328@debbugs.gnu.org To: Thuna Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 29 18:04:06 2024 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 1sYSqy-0007IZ-VG for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Jul 2024 18:04:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sYSqn-0003it-88; Mon, 29 Jul 2024 12:03:53 -0400 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 1sYSqj-0003cy-SP for bug-gnu-emacs@gnu.org; Mon, 29 Jul 2024 12:03:50 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sYSqj-0008Lt-JE for bug-gnu-emacs@gnu.org; Mon, 29 Jul 2024 12:03:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=wFOrOlkObCB3PUXvQ6S+sPZptqau8HIKQa9ggJ5ZNCw=; b=Ex6nVLzJeCmxOmjY6AEZCHr+P0VgCRGTUxCS2zkPgfBb7NLmfgnux5OAeTfY833asyB80arF9lnB5Kqvg+fzMWzMzXZ6c7mn1dSE/Xqs+H/Rw/kiD93OGrATfKTY61qT8YCtSo82VamkZfGYGGWNeO0GNynQpxg8/HNEvHD3WXVRKciiRRtPHRjyVZcAWPdvtjrVGjLTnJVcThaxC+yNJjkYyUkXfpMT/aVWIUd+CsVeQqTqgRDFncurojZaxabbBwbImvYWZ+LXPV32qXa/WfbpLgbHFAAex5IrrCWPnmnHyDousKmBXN4JVxSXKVLw54daHYH/TSMHFt9PFFzq2w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sYSqw-000864-48 for bug-gnu-emacs@gnu.org; Mon, 29 Jul 2024 12:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Jul 2024 16:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72328 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 72328-submit@debbugs.gnu.org id=B72328.172226902031082 (code B ref 72328); Mon, 29 Jul 2024 16:04:02 +0000 Original-Received: (at 72328) by debbugs.gnu.org; 29 Jul 2024 16:03:40 +0000 Original-Received: from localhost ([127.0.0.1]:46218 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sYSqZ-00085F-FD for submit@debbugs.gnu.org; Mon, 29 Jul 2024 12:03:39 -0400 Original-Received: from mout.web.de ([212.227.15.4]:53975) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sYSqV-00084o-0I for 72328@debbugs.gnu.org; Mon, 29 Jul 2024 12:03:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1722268991; x=1722873791; i=michael_heerdegen@web.de; bh=wFOrOlkObCB3PUXvQ6S+sPZptqau8HIKQa9ggJ5ZNCw=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=Z225+j2NnSlh9ZWYIIMbIAN4ziJqk4EBpMzaW21cysq4Wqq+lJau2iz4qqcgYtc7 S1kvigQ3uEN6HuOyFH9Ur8BxxoUIrONb2Vcx6mbatiF3hf6Tbo76GZMCAjVjrU28l vonsLzKvLnaei7O42vhlzghHIxOlp+Y79YXaPflvpRzL2ZsMNEGPxASLde+jKY72u mt7gIPOvB5vBaUI+jKkNP0id+kO7wdCfurwgEqb15uG+/hBK7fexrtDMBjkI2sH1O k9eCyw+02Z6T5YIEXgv1BUmGSutSRqjjJa1rXOui2nkNcmw67ZlPBq2LqHtEL+hT5 yXH0iF53BsSY6N8agg== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from drachen.dragon ([84.59.210.113]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1N79RI-1sDQtn0zOu-013KYi; Mon, 29 Jul 2024 18:03:11 +0200 In-Reply-To: <871q3d347e.fsf@gmail.com> (Thuna's message of "Sun, 28 Jul 2024 17:51:17 +0200") X-Provags-ID: V03:K1:T0N1VBGqH6TebyEX2o3/hhyHwYhp32LWtGBYk4kz6jv50hdFU+J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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:289523 Archived-At: Thuna writes: > > This would be a backward-incompatible change, breaking existing code. > > Yes, I forgot to mention this in my original report, but given how > unintuitive (IMO) the current behavior is, I expect that very few people > will be using patterns which would be effected by this change. We have _dozens_ of such patterns in the Emacs Elisp sources that would break. Your expectation is wrong. > > And this change would break the symmetry between `backquote' the macro > > and backquote patterns in `pcase'. This is an important design idea. > > I am not quite sure why you think that this breaks symmetry with the > backquote macro; We want that something like this works as expected: #+begin_src emacs-lisp (let ((a 1) (b 2)) (pcase `(69 foo (97 ,a ((,b)))) (`(69 foo (97 ,a ((,b)))) (list a b)))) =3D=3D> (1 2) #+end_src I think it's obvious what I mean with symmetry between backquote and pcase backquote without giving a formal definition. > the purpose of this patch was to establish a symmetry > in the first place. Would you consider the examples provided as > unnatural? I'm more concerned about what we would loose. > AFAICT right now the only way to match an unevaluated (or quoted) `,foo > is with `(,'\` (,'\, foo)) which is quite unideal. If `foo` is the literal symbol you can simply match using a quote pattern like in (pcase '`,foo ('`,foo t)) =3D=3D> t > It is not often that you need this but having this not be > representable in this way is not particularly useful. It indeed gets ugly when one wants to match a non-constant backquote expression using a backquote pcase pattern with partial unquotes (the "mixed case"). But making pcase backquote patterns less expressive just to make this special case simpler doesn't make sense to me. OTOH I agree that having a convenient solution for this kind of problem would be nice. Michael.