summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/pcase.el
diff options
context:
space:
mode:
authorPhilip Kaludercic <philipk@posteo.net>2024-08-04 16:52:38 +0200
committerPhilip Kaludercic <philipk@posteo.net>2024-08-04 16:53:51 +0200
commit0756f3085ea948c945e309e2ce347fc5ab836574 (patch)
treea12350e5cdf9d8ae8d862d38e8abfb0635fd372b /lisp/emacs-lisp/pcase.el
parent1b806a200edcb893471237f47e969dbb9d6a99f1 (diff)
downloademacs-0756f3085ea948c945e309e2ce347fc5ab836574.tar.gz
emacs-0756f3085ea948c945e309e2ce347fc5ab836574.tar.bz2
emacs-0756f3085ea948c945e309e2ce347fc5ab836574.zip
Clarify that 'pcase-lambda' only destructs
* lisp/emacs-lisp/pcase.el (pcase-lambda): Copy notice from 'pcase-let', indicating that pcase-lambda won't pattern match like 'pcase', but just try to destruct with uncertain side effects if this fails. (Bug#71503)
Diffstat (limited to 'lisp/emacs-lisp/pcase.el')
-rw-r--r--lisp/emacs-lisp/pcase.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 5a7f3995311..fd6b0c8db5c 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -241,9 +241,14 @@ not signal an error."
;;;###autoload
(defmacro pcase-lambda (lambda-list &rest body)
"Like `lambda' but allow each argument to be a pattern.
-I.e. accepts the usual &optional and &rest keywords, but every
-formal argument can be any pattern accepted by `pcase' (a mere
-variable name being but a special case of it)."
+I.e. accepts the usual &optional and &rest keywords, but every formal
+argument can be any pattern destructed by `pcase-let' (a mere variable
+name being but a special case of it).
+
+Each argument should match its respective pattern in the parameter
+list (i.e. be of a compatible structure); a mismatch may signal an error
+or may go undetected, binding arguments to arbitrary values, such as
+nil."
(declare (doc-string 2) (indent defun)
(debug (&define (&rest pcase-PAT) lambda-doc def-body)))
(let* ((bindings ())