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

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

Re: unused lexical variable in `cl-loop'


From: Emanuel Berg
Subject: Re: unused lexical variable in `cl-loop'
Date: Sat, 01 Oct 2022 00:59:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Felix Dietrich wrote:

>   (cl-block nil
>     (let*
>         ((i min)
>          (--cl-var-- max)
>          (num nil)
>          (num nil))
>       (while
>           (<= i --cl-var--)
>         (setq num
>               (nconc num
>                      (list i)))
>         (setq i
>               (+ i 1)))
>       num))
>
> The variable ‘num’ is bound twice

That's right, if you bind the same lexical/static variable
more than once you get the "Unused lexical variable" warning
for every occasion and it doesn't matter if it's used or not.

(let ((one 1)  
      (one 1) )
  one)

;; Warning: Unused lexical variable `one'
;; Warning: Unused lexical variable `one'

But if you do this ...

(let ((one 1)
      (one 2) )
  one)

You only get a warning for the first one ...

;; Warning: Unused lexical variable `one'

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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