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: Emanuel Berg
Subject: Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?
Date: Fri, 08 Jan 2021 14:31:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Philipp Stephani wrote:

>> No! Again, this is a problem with the byte compiler.
>
> Not really. The byte compiler can only compile what's
> macro-expanded

If the byte compiler because of its nature is incapable of
doing something, it shouldn't attempt or say anything...

> 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.

Hm... what is the definition of being used in terms of
a variable? read/write?

Also, that is a stub, I don't remember what the OP did but he
did use it and I think this is what one thinks the byte
compiler is referring to with its warning rather than certain
parts of what is macro-expanded...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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