unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Michael Heerdegen <michael_heerdegen@web.de>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Cc: thuna.cing@gmail.com, 72328@debbugs.gnu.org
Subject: bug#72328: [PATCH] Nested backquote in pcase
Date: Mon, 29 Jul 2024 19:45:29 +0300	[thread overview]
Message-ID: <867cd4ywnq.fsf@gnu.org> (raw)
In-Reply-To: <877cd4rxqo.fsf@web.de> (bug-gnu-emacs@gnu.org)

> Cc: 72328@debbugs.gnu.org
> Date: Mon, 29 Jul 2024 18:03:59 +0200
> From:  Michael Heerdegen via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Thuna <thuna.cing@gmail.com> 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)))) ==> (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))
>  ==> 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.

Stefan, any comments?





  reply	other threads:[~2024-07-29 16:45 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-28  0:40 bug#72328: [PATCH] Nested backquote in pcase Thuna
2024-07-28 14:52 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-28 15:51   ` Thuna
2024-07-28 16:02     ` Eli Zaretskii
2024-07-28 16:20       ` Thuna
2024-07-29 16:03     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-29 16:45       ` Eli Zaretskii [this message]
2024-07-30  7:45         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-03  0:07           ` Thuna
2024-08-03  5:59             ` Eli Zaretskii
2024-08-03 13:22               ` Thuna
2024-08-04 17:10                 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-04 21:27                   ` Thuna
2024-08-05 11:52                     ` Eli Zaretskii
2024-08-05 19:32                       ` Thuna
2024-08-06  8:21                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-06 11:13                         ` Eli Zaretskii
2024-08-06 13:09                           ` Thuna
2024-08-07  3:33                             ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-07 11:53                               ` Eli Zaretskii
2024-08-07 17:34                               ` Thuna
2024-08-08  5:57                                 ` Eli Zaretskii
2024-08-23  3:25                                   ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-23 14:49                                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-23 16:04                                       ` Eli Zaretskii
2024-08-23 19:11                                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-23 19:29                                           ` Eli Zaretskii
2024-09-07  7:18                                             ` Eli Zaretskii
2024-09-07 12:24                                               ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-21  9:03                                                 ` Eli Zaretskii
2024-09-22 13:30                                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-22 14:16                                                   ` Eli Zaretskii
2024-09-22 15:21                                                     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-23 11:16                                                       ` Eli Zaretskii
2024-09-24 18:02                                                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-25 19:04                                                           ` Adam Porter
2024-09-26  6:13                                                             ` Eli Zaretskii
2024-09-26 14:05                                                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-26 20:41                                                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-23 20:19                                         ` Thuna
2024-07-29 17:43       ` Thuna
2024-07-29 19:05         ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-29 20:45         ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-29 20:59           ` Thuna
2024-07-30 17:53             ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=867cd4ywnq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=72328@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=thuna.cing@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).