help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to avoid compiler warning `unused lexical variable' for `dolist'


From: Philipp Stephani
Subject: Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?
Date: Fri, 8 Jan 2021 14:15:26 +0100

Am Fr., 8. Jan. 2021 um 13:39 Uhr schrieb Emanuel Berg via Users list
for the GNU Emacs text editor <help-gnu-emacs@gnu.org>:

> No! Again, this is a problem with the byte compiler.

Not really. The byte compiler can only compile what's macro-expanded,
and the macro-expansion of e.g. (dotimes (i 5 t) i) is roughly:

(let ((counter 0))
  (while (< counter 5)
    (let ((i counter))
      i)
    (setq counter (1+ counter)))
  (let ((i counter))
    t))

As you can see, `i' is definitely unused in the second `let' form -
the byte compiler is right.



reply via email to

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