Subject: bug#72328: [PATCH] Nested backquote in pcase

From: Thuna <[email-masked]>
Date: Mon, 29 Jul 2024 22:59:03 +0200

>> I feel like there is a possible misunderstanding.  I am not preventing a
>> backquote pattern from going deeper into a list.  Your example would
>> remain perfectly consistent under the new behavior.  What *wouldn't*,
>> however, is something like
>>
>> (let ((a 1) (b 2))
>>  (pcase `(69 foo `(,bar ,,a ((,,b))))
>>    (`(69 foo `(,bar ,,a ((,,b))))
>>     (list a b))))
>
> Ok - so backquote the macro handles nested invocations of backquote
> specially (the nested calls are not expanded individually, only the
> outermost backquote expression gets expanded), while the pcase' backquote
> implementation is backquote agnostic, it currently treats it like any
> random symbol.  Your patch tries to adapt pcase backquote to the
> backquote macro semantics.  Correct?

Yes, that is precisely the case.  I'm afraid I wasn't able to explain it
well enough.

> If there aren't any downsides then this makes a lot of sense and would
> be a good thing to do indeed.

The one downside that I can see is the situation I mentioned in my
previous message where you explicitly *want* to bypass all backquotes,
plus the fact that this is backwards incompatible, even though to be
effected you would need to be making use of the fact that comma behaves
this way - which I still don't believe will be too common - though there
could be an obsoletion period where comma still bypasses backquotes but
warns the user to change off of that behavior.  All code making use of
the new behavior will firmly be incompatible with older versions of
emacs for which this is not patched, however.