GNU bug report logs - #71120
29.3; buglet in cl-loop

Previous Next

Package: emacs;

Reported by: Philippe Schnoebelen <phs <at> lmf.cnrs.fr>

Date: Wed, 22 May 2024 14:49:02 UTC

Severity: normal

Found in version 29.3

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Philippe Schnoebelen <phs <at> lmf.cnrs.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.3; buglet in cl-loop
Date: Wed, 22 May 2024 10:43:36 +0200
When I need a list of 100 random dice throws I write

	(cl-loop for i from 1 to 100 collect (random 6))

It compiles just fine.

If instead I use

	(cl-loop for _i from 1 to 100 collect (random 6))

then I get a compilation warning:

	foo.el:1:18: Warning: variable ā€˜_i’ not left unused

It should be the other way around.

The variable 'i' is unused in the first form and that deserves a warning 
at compile time. Otherwise the compiler will not help me catch the typo in

	(cl-loop for i from 0 to 10 do
	   (cl-loop for j from 0 to 10 do
	      (foo j j))) ;; <<<=== typo, I meant (foo i j)


--ph.schnoebelen, happy and thankful GNU Emacs user since 1983 (Thanks 
to all involved!!)





This bug report was last modified 79 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.