emacs-devel
[Top][All Lists]
Advanced

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

RE: master 8f0f851: * lisp/autoarg.el: Use lexical binding.


From: Drew Adams
Subject: RE: master 8f0f851: * lisp/autoarg.el: Use lexical binding.
Date: Mon, 20 Apr 2020 07:55:27 -0700 (PDT)

> > I don't think I understand the original warning though.

Same here.

> > This minimized code example gives me "Unused lexical
> > variable 'i'" when byte-compiled:
> >
> > (let (alist)
> >   (dotimes (i 10 alist) (push i alist)))
> 
> It's unused in the expression `alist`.

So?  (defun foo (a) (message "%s" a) 42) doesn't use
`a' in the value returned.  We don't warn about that,
do we?

> If you don't use `i` there, then you should do:
> (let (alist)
>   (dotimes (i 10) (push i alist))
>   alist)

Doesn't seem right to have such a distinction.  Is
this just an implementation artifact (essentially a
bug), or is there a good reason for the warning in
the first case (and not in the second)?

FWIW, all that Common Lisp says about its `dotimes'
in this regard is this:

"At the time result-form is processed, VAR is bound
to the number of times the body was executed."

Why should we warn, if the result form doesn't use
the variable?



reply via email to

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