From: Robert Cochran <robert-emacs@cochranmail.com>
To: Chunyang Xu <xuchunyang.me@gmail.com>
Cc: 24362@debbugs.gnu.org
Subject: bug#24362: 25.1.50; Inconsistent docstring between pcase-let and pcase-let*
Date: Wed, 14 Sep 2016 16:06:57 -0700 [thread overview]
Message-ID: <87fup2nkry.fsf@cochranmail.com> (raw)
In-Reply-To: <m2wpisxpcy.fsf@gmail.com> (Chunyang Xu's message of "Sun, 04 Sep 2016 12:26:05 +0800")
[-- Attachment #1: Type: text/plain, Size: 1459 bytes --]
Chunyang Xu <xuchunyang.me@gmail.com> writes:
> It looks like, to me, the structure of the BODY arg of these two should
> be the same (accepting a list froms).
>
> (pcase-let ((a 1))
> (incf a)
> a)
> => 2
>
> (pcase-let* ((a 1))
> (incf a)
> a)
> => 2
It appears to be so. Here's what I did:
(pcase-let* ((a 1)
(b 2))
(message "%d" a)
(message "%d" b))
and ended up with
1
2
in my *Messages* buffer.
> but the docstrings are using the different words.
>
> (pcase-let BINDINGS &rest BODY)
>
> Like `let' but where you can use `pcase' patterns for bindings.
> BODY should be a list of expressions, and BINDINGS should be a list of bindings
> ^^^^^^^^^^^^^^^^^^^^^
> of the form (PAT EXP).
>
> (pcase-let* BINDINGS &rest BODY)
>
> Like `let*' but where you can use `pcase' patterns for bindings.
> BODY should be an expression, and BINDINGS should be a list of bindings
> ^^^^^^^^^^^^^
> of the form (PAT EXP).
This patch changes the pcase-let* docstring to match the pcase-let
docstring, but IMO I don't think that the phrase 'a list of expressions'
is exactly the right term for this. That (to me) implies that we are
wrapping the whole body in a list, which you don't.
For example -
; What that phrase implies to me:
(pcase-let ((a 1))
((incf a)
a))
But I have no idea how to better phrase this. For certain, though, they
ought to match because they both behave the same way.
-----
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix docstring of pcase-let* to accurately reflect what BODY can be --]
[-- Type: text/x-patch, Size: 1179 bytes --]
From c41219fcbbb01b5a219733ac54ad2cade438513b Mon Sep 17 00:00:00 2001
From: Robert Cochran <robert-git@cochranmail.com>
Date: Wed, 14 Sep 2016 15:52:29 -0700
Subject: [PATCH] Fix docstring of pcase-let*
pcase-let*'s docstring could have been taken to mean that the BODY
parameter can only be a single expression, but it can be any numbers of
expressions. Fix it to be more accurate.
* lisp/emacs-lisp/pcase.el (pcase-let*): Fix docstring to be more
accurate about what the BODY parameter can be.
---
lisp/emacs-lisp/pcase.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 0b8dddf..2d61642 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -261,7 +261,7 @@ pcase--let*
;;;###autoload
(defmacro pcase-let* (bindings &rest body)
"Like `let*' but where you can use `pcase' patterns for bindings.
-BODY should be an expression, and BINDINGS should be a list of bindings
+BODY should be a list of expressions, and BINDINGS should be a list of bindings
of the form (PAT EXP)."
(declare (indent 1)
(debug ((&rest (pcase-PAT &optional form)) body)))
--
2.7.4
[-- Attachment #3: Type: text/plain, Size: 102 bytes --]
-----
HTH,
--
~Robert Cochran
GPG Fingerprint - E778 2DD4 FEA6 6A68 6F26 AD2D E5C3 EB36 4886 8871
next prev parent reply other threads:[~2016-09-14 23:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-04 4:26 bug#24362: 25.1.50; Inconsistent docstring between pcase-let and pcase-let* Chunyang Xu
2016-09-14 23:06 ` Robert Cochran [this message]
2016-09-15 21:36 ` Michael Heerdegen
2016-09-15 21:57 ` Robert Cochran
2016-09-15 22:00 ` Drew Adams
2016-09-15 22:40 ` Michael Heerdegen
2016-09-23 16:26 ` Michael Heerdegen
2016-09-23 20:45 ` Robert Cochran
2016-09-25 14:32 ` Michael Heerdegen
2016-09-26 23:39 ` Robert Cochran
2019-11-08 3:43 ` Stefan Kangas
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fup2nkry.fsf@cochranmail.com \
--to=robert-emacs@cochranmail.com \
--cc=24362@debbugs.gnu.org \
--cc=xuchunyang.me@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.