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: Tomas Hlavaty
Subject: Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?
Date: Sat, 09 Jan 2021 19:57:26 +0100

On Fri 08 Jan 2021 at 02:10, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>       (let ((i --dotimes-counter--)) plist))

In Common Lisp, that part would be solved by (declare (ignorable i)) in
the macro:

(let ((i --dotimes-counter--))
  (declare (ignorable i))
  plist)

I do not know if Emacs Lisp has ignorable.
Maybe this is the missing bit?

> You won't get this warning if you do:
>
>     (dotimes (i length (progn (ignore i) plist))
>       (setf plist (plist-put plist (intern (elt columns i)) (elt values i))))
> or
>     (dotimes (i length)
>       (setf plist (plist-put plist (intern (elt columns i)) (elt values i))))
>     plist

This is just moving the problem from macro author to macro users.



reply via email to

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