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: Michael Heerdegen
Subject: bug#49809: [PATCH] Add macro 'pcase-setq'
Date: Sat, 07 Aug 2021 04:11:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Okam via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@gnu.org> writes:

> +(defmacro pcase-setq (pat val &rest args)
> +  "Assign values to variables by destructuring with `pcase'.
> +
> +\(fn PATTERN VALUE PATTERN VALUE ...)"

Can we maybe enhance the docstring a bit?  I think we should at least
cover these points:

- The PATTERNs are normal `pcase' patterns, the VALUES are expressions.

- Evaluation happens sequentially as in `setq' (not in parallel)

- When a PATTERN doesn't match it's VALUE, the pair is silently skipped
  (completely, no partial assignments are performed, AFAIU)

Maybe adding a simple example would not be too bad as well?


Thanks,

Michael.






reply via email to

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