bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#49809: [PATCH] Add macro 'pcase-setq'


From: Stefan Monnier
Subject: bug#49809: [PATCH] Add macro 'pcase-setq'
Date: Thu, 05 Aug 2021 09:34:55 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Michael Heerdegen [2021-08-05 03:02:03] wrote:
> Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
>
>> Looks good.
>
> How much trouble would it be to provide a `setf' variant?
>
> A problem could be any syntax that is used for both pcase patterns and
> place expressions I guess.

Adding support for (setf (pcase PAT) VAL) is very easy to do without any
change to pcase or gv machinery.

Adding support for (setf PAT VAL), is a bit harder (and introduces
a risk because of the potential overlap, tho this risk is small: gv
places are normally defined for "eliminators" whereas pcase patterns are
usually defined for "constructors"), but still fairly easy.

Mixing pcase patterns and gv places as in

    (setf `(,a . ,(aref V N)) EXP)

would be the most flexible option but I haven't thought much about how
hard it would be to implement, and I'm not sure it's worth the trouble.


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]