From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 26960@debbugs.gnu.org, 8711@debbugs.gnu.org,
Helmut Eller <eller.helmut@gmail.com>
Subject: bug#26960: 26.0.50; Complaints about unused variable in cl-destructuring-bind
Date: Sun, 08 May 2022 09:32:01 -0400 [thread overview]
Message-ID: <jwv4k20yytp.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <871qx4i4pe.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 08 May 2022 14:33:49 +0200")
> I can reproduce this in Emacs 25.1, but not in Emacs 29. That is,
> there's no warning for `foo'. There's still a warning for `bar', but
> that's correct, isn't it?
Yes.
> `ignore' is just a normal function, so _ is used there.
It's not 100% normal, but yes.
> However, this example from a merged bug report is giving a warning:
>
>> ;;; -*- lexical-binding: t; -*-
>> (require 'cl-lib)
>> (cl-destructuring-bind (&whole a b &rest _) '(1 2)
>> (print (list a b)))
>
> And that seems like a bug?
Indeed. If you look at the macroexpanded code, you see that
`cl-destructuring-bind` uses:
(let* ((_ '(1 2))
(a _)
(b (if _ (pop _)
(signal 'wrong-number-of-arguments
(list '(&whole a b &rest _) (length _))))))
(print (list a b)))
so, you can see that the problem is that `cl-destructuring-bind` tries
to avoid using gensym and "abuses" the &rest var as the "iterator"
variable while parsing the list.
It might have been useful back in the dynbinding days because `setq`
might have been a bit cheaper than `let`, but with lexical scoping
`let` byte-compiles to virtually nothing.
Stefan
next prev parent reply other threads:[~2022-05-08 13:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-21 18:44 bug#8711: 24.0.50; binding _ to unused values with lexical-binding Helmut Eller
2011-05-23 9:01 ` Lawrence Mitchell
2011-05-23 14:24 ` Stefan Monnier
2011-05-23 18:23 ` Helmut Eller
2011-05-23 19:29 ` Stefan Monnier
2011-05-23 20:16 ` Helmut Eller
2011-05-24 0:56 ` Stefan Monnier
2011-05-24 6:01 ` Helmut Eller
2011-05-24 12:42 ` Stefan Monnier
2011-06-02 11:17 ` Juanma Barranquero
2011-06-02 12:45 ` Stefan Monnier
2011-06-02 13:41 ` Juanma Barranquero
2011-06-02 14:00 ` Stefan Monnier
2011-06-02 17:10 ` Juanma Barranquero
2011-05-23 20:32 ` Helmut Eller
2011-05-24 0:51 ` Stefan Monnier
2022-05-08 12:33 ` bug#8711: bug#26960: 26.0.50; Complaints about unused variable in cl-destructuring-bind Lars Ingebrigtsen
2022-05-08 13:32 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-05-09 9:25 ` Lars Ingebrigtsen
2022-05-09 12:26 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
-- strict thread matches above, loose matches on Subject: below --
2017-05-17 9:23 Philipp Stephani
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv4k20yytp.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=26960@debbugs.gnu.org \
--cc=8711@debbugs.gnu.org \
--cc=eller.helmut@gmail.com \
--cc=larsi@gnus.org \
--cc=monnier@iro.umontreal.ca \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).