* bug#12369: 24.2.50; cl-loop: variable not left unused
@ 2012-09-06 13:06 Christopher Schmidt
2012-09-06 15:43 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Christopher Schmidt @ 2012-09-06 13:06 UTC (permalink / raw)
To: 12369
severity: minor
;; -*- lexical-binding: t -*-
(require 'cl-lib)
(cl-loop for (rms . emacs) in nil)
Byte compile this piece of code.
Warning: Unused lexical variable `rms'
Attempting to fix this warning by renaming rms to _rms results in
another warning.
Warning: variable `_rms' not left unused
GNU Emacs 24.2.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10) of
2012-09-06.
Christopher
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#12369: 24.2.50; cl-loop: variable not left unused
2012-09-06 13:06 bug#12369: 24.2.50; cl-loop: variable not left unused Christopher Schmidt
@ 2012-09-06 15:43 ` Stefan Monnier
2021-06-01 7:18 ` Lars Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2012-09-06 15:43 UTC (permalink / raw)
To: 12369
> ;; -*- lexical-binding: t -*-
> (require 'cl-lib)
> (cl-loop for (rms . emacs) in nil)
> Byte compile this piece of code.
> Warning: Unused lexical variable `rms'
Yes, first bug: `emacs' is not listed as unused.
> Attempting to fix this warning by renaming rms to _rms results in
> another warning.
> Warning: variable `_rms' not left unused
Yup, second bug.
This is all due to the code generated by cl-loop which was optimized to
use `set' in the loop instead of `let'. This made sense for dynamically
scoped code where `let' is a bit slower, but for lexically-scoped code,
it's the exact opposite, so we should change the generated code from:
(identity
(catch '--cl-block-nil--
(let* ((--cl-var-- nil)
(emacs nil) (rms nil))
(while (consp --cl-var--)
(setq emacs (car --cl-var--) rms (pop emacs))
(setq --cl-var-- (cdr --cl-var--)))
nil)))
to
(identity
(catch '--cl-block-nil--
(let* ((--cl-var-- nil))
(while (consp --cl-var--)
(let* ((tmp (car --cl-var--))
(emacs (car tmp))
(rms (cdr tmp)))
(setq --cl-var-- (cdr --cl-var--))))
nil)))
-- Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#12369: 24.2.50; cl-loop: variable not left unused
2012-09-06 15:43 ` Stefan Monnier
@ 2021-06-01 7:18 ` Lars Ingebrigtsen
2021-06-05 20:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-01 7:18 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 12369
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> ;; -*- lexical-binding: t -*-
>> (require 'cl-lib)
>> (cl-loop for (rms . emacs) in nil)
>> Byte compile this piece of code.
>> Warning: Unused lexical variable `rms'
>
> Yes, first bug: `emacs' is not listed as unused.
This problem is still present in Emacs 28.
>> Attempting to fix this warning by renaming rms to _rms results in
>> another warning.
>> Warning: variable `_rms' not left unused
>
> Yup, second bug.
This one is fixed, though.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#12369: 24.2.50; cl-loop: variable not left unused
2021-06-01 7:18 ` Lars Ingebrigtsen
@ 2021-06-05 20:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-06-05 20:08 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 12369
>>> ;; -*- lexical-binding: t -*-
>>> (require 'cl-lib)
>>> (cl-loop for (rms . emacs) in nil)
>>> Byte compile this piece of code.
>>> Warning: Unused lexical variable `rms'
>> Yes, first bug: `emacs' is not listed as unused.
> This problem is still present in Emacs 28.
Indeed, because it *is* used internally by the code expanded from the
destructuring-bind.
>>> Attempting to fix this warning by renaming rms to _rms results in
>>> another warning.
>>> Warning: variable `_rms' not left unused
>> Yup, second bug.
> This one is fixed, though.
Hmm... I wonder what caused this change.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-05 20:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-06 13:06 bug#12369: 24.2.50; cl-loop: variable not left unused Christopher Schmidt
2012-09-06 15:43 ` Stefan Monnier
2021-06-01 7:18 ` Lars Ingebrigtsen
2021-06-05 20:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
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.