GNU logs - #71120, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#71120: 29.3; buglet in cl-loop
Resent-From: Philippe Schnoebelen <phs@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 22 May 2024 14:49:02 +0000
Resent-Message-ID: <handler.71120.B.171638932014696 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 71120
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 71120 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.171638932014696
          (code B ref -1); Wed, 22 May 2024 14:49:02 +0000
Received: (at submit) by debbugs.gnu.org; 22 May 2024 14:48:40 +0000
Received: from localhost ([127.0.0.1]:56365 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s9nGi-0003os-0c
	for submit <at> debbugs.gnu.org; Wed, 22 May 2024 10:48:40 -0400
Received: from lists.gnu.org ([209.51.188.17]:52086)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <phs@HIDDEN>) id 1s9hZe-0008BN-Ed
 for submit <at> debbugs.gnu.org; Wed, 22 May 2024 04:43:52 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <phs@HIDDEN>) id 1s9hZY-0008Qu-CV
 for bug-gnu-emacs@HIDDEN; Wed, 22 May 2024 04:43:44 -0400
Received: from mx.lmf.cnrs.fr ([195.220.198.153])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <phs@HIDDEN>) id 1s9hZV-00063P-VQ
 for bug-gnu-emacs@HIDDEN; Wed, 22 May 2024 04:43:44 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lmf.cnrs.fr; s=mail;
 t=1716367416; bh=Blpta2WMuXzlmDAqqazskBtpwxxYbt5yAXaS3GUuzgA=;
 h=Date:To:From:Subject:From;
 b=SIKoEstXapt4naR472j9PN+Srn/9fCpBvlQh8Le8FAUUdg/V7kDjcY8Fq+nAic51x
 LXT2+YsZPDjyYJes/1vVZw/MUzQXkyzUseJH4xxDU22ukdr5l1AJR1s9GVzmtSJCV4
 YiY42cCQ4X9uagXgFSlCUMp1fD7fTOIpnJGtjHQv900zEncHVZ7pyy18XK8k8dRZ7F
 sRTFkNfM7ncj1dZpp+zcakhwBgsFkQVjvSCkokLYH94Hl5YUQzYquQNuJdLXXLJ4qw
 z3vNj8Co4gqCb7KRsJlv9ues/ckAJsyAU7BEWMwgcWULOdIR4DpbIz+WwOnXFy3e8r
 wgBo3Lf+R8FFQ==
Received: from authenticated-user (mx.lmf.cnrs.fr [195.220.198.153])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mx.lmf.cnrs.fr (Postfix) with ESMTPSA id C83153F66E
 for <bug-gnu-emacs@HIDDEN>; Wed, 22 May 2024 10:43:36 +0200 (CEST)
Message-ID: <23fd70f8-6e01-45d7-b9f9-d81d53c95ffd@HIDDEN>
Date: Wed, 22 May 2024 10:43:36 +0200
MIME-Version: 1.0
Content-Language: fr
From: Philippe Schnoebelen <phs@HIDDEN>
Autocrypt: addr=phs@HIDDEN; keydata=
 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
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=195.220.198.153; envelope-from=phs@HIDDEN;
 helo=mx.lmf.cnrs.fr
X-Spam_score_int: -19
X-Spam_score: -2.0
X-Spam_bar: --
X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Mailman-Approved-At: Wed, 22 May 2024 10:48:36 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

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!!)





Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Philippe Schnoebelen <phs@HIDDEN>
Subject: bug#71120: Acknowledgement (29.3; buglet in cl-loop)
Message-ID: <handler.71120.B.171638932014696.ack <at> debbugs.gnu.org>
References: <23fd70f8-6e01-45d7-b9f9-d81d53c95ffd@HIDDEN>
X-Gnu-PR-Message: ack 71120
X-Gnu-PR-Package: emacs
Reply-To: 71120 <at> debbugs.gnu.org
Date: Wed, 22 May 2024 14:49:03 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 71120 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
71120: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D71120
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#71120: 29.3; buglet in cl-loop
Resent-From: Philip Kaludercic <philipk@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 29 May 2024 20:49:01 +0000
Resent-Message-ID: <handler.71120.B71120.171701570421580 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 71120
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Philippe Schnoebelen <phs@HIDDEN>
Cc: 71120 <at> debbugs.gnu.org, Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
Received: via spool by 71120-submit <at> debbugs.gnu.org id=B71120.171701570421580
          (code B ref 71120); Wed, 29 May 2024 20:49:01 +0000
Received: (at 71120) by debbugs.gnu.org; 29 May 2024 20:48:24 +0000
Received: from localhost ([127.0.0.1]:53714 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sCQDf-0005bx-Kz
	for submit <at> debbugs.gnu.org; Wed, 29 May 2024 16:48:24 -0400
Received: from mout01.posteo.de ([185.67.36.65]:36539)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1sCQDd-0005bZ-RN
 for 71120 <at> debbugs.gnu.org; Wed, 29 May 2024 16:48:23 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 5137724002D
 for <71120 <at> debbugs.gnu.org>; Wed, 29 May 2024 22:48:01 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1717015685; bh=ADbFYwwf+mszdxEwcXuw8qaLBTtBU7Mz/AwLY+yO1ek=;
 h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version:
 Content-Type:Content-Transfer-Encoding:From;
 b=d9nVWilfPaQ2nqhvrmN2h86X7QSuiO8D41Hf4vFtAN+q9W4J2xJb455+KyIrX4RP1
 3ns9g7qmvaMZjKN+yUXT7z9MtJBzq0B34rOrWJf43WIEk1gaQL7jN7uWpVRoEvwj+o
 ozWqRszHlm6OsNvJH96i/NSl8ic3VLYJlb96Ooq2GEYKjZltNlJ1FXc5IpqtonprGp
 PW1Nt+cohbPydYHwky62zP5uFrdwCc0PsKfNxfmFHzvryssfqNpzRRHzmI/1DQ3P1+
 nOQJgXLsvANOpPP7cxIXSSVuWFNKIzOQHtmxrByQ+EZDDt7Xitl+stQ4dJF34fPhwm
 vKD7pFTCedKMw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4VqM0G0RwTz9rxK;
 Wed, 29 May 2024 22:47:57 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
In-Reply-To: <23fd70f8-6e01-45d7-b9f9-d81d53c95ffd@HIDDEN> (Philippe
 Schnoebelen's message of "Wed, 22 May 2024 10:43:36 +0200")
References: <23fd70f8-6e01-45d7-b9f9-d81d53c95ffd@HIDDEN>
OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66;
 url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66";
 preference=signencrypt
Date: Wed, 29 May 2024 20:47:56 +0000
Message-ID: <87cyp4wdj7.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Philippe Schnoebelen <phs@HIDDEN> writes:

> 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 =E2=80=98_i=E2=80=99 not left unused
>
> It should be the other way around.

The issue here is that the warning describes an issue in the output, in
the latter case

  (let* ((_i 1) (--cl-var-- nil))
    (while (<=3D _i 100)
      (setq --cl-var-- (cons (random 6) --cl-var--))
      (setq _i (+ _i 1)))
    (nreverse --cl-var--))

As you see, _i is both evaluated in (+ _i 1) and updated.

Here you have a minimal working example of the warning:

  (byte-compile (lambda () (let ((_x 3)) _x)))

  ;; Warning: variable =E2=80=98_x=E2=80=99 not left unused

My guess is that fixing this would require cl-loop to notice that the
counter is prefixed with a "_" and then use some other variable, but
that might lead to issues with existing code.  Perhaps this
transformation might be safe in that case:

  (let* ((<fresh-variable> 1) (--cl-var-- nil))
    (while (<=3D <fresh-variable> 100)
      (let ((_i <fresh-variable>))
	(setq --cl-var-- (cons (random 6) --cl-var--))
	(setq <fresh-variable> (+ <fresh-variable> 1))))
    (nreverse --cl-var--))

I have added Mattias and Stefan to the CCs, as they'll probably have
more qualified comments to add.

>
> 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))) ;; <<<=3D=3D=3D typo, I meant (foo i j)
>
>
> --ph.schnoebelen, happy and thankful GNU Emacs user since 1983 (Thanks
>   to all involved!!)
>
>
>
>
>

--=20
	Philip Kaludercic on peregrine




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#71120: 29.3; buglet in cl-loop
Resent-From: Andrea Corallo <acorallo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 29 May 2024 21:35:02 +0000
Resent-Message-ID: <handler.71120.B71120.171701845030248 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 71120
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Philip Kaludercic <philipk@HIDDEN>
Cc: 71120 <at> debbugs.gnu.org, Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, Philippe Schnoebelen <phs@HIDDEN>
Received: via spool by 71120-submit <at> debbugs.gnu.org id=B71120.171701845030248
          (code B ref 71120); Wed, 29 May 2024 21:35:02 +0000
Received: (at 71120) by debbugs.gnu.org; 29 May 2024 21:34:10 +0000
Received: from localhost ([127.0.0.1]:55715 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sCQvx-0007ro-VF
	for submit <at> debbugs.gnu.org; Wed, 29 May 2024 17:34:10 -0400
Received: from eggs.gnu.org ([209.51.188.92]:34354)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acorallo@HIDDEN>) id 1sCQvw-0007rB-8Y
 for 71120 <at> debbugs.gnu.org; Wed, 29 May 2024 17:34:09 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acorallo@HIDDEN>)
 id 1sCQve-0000Wv-Ec; Wed, 29 May 2024 17:33:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=DKDHKbWHQAcfP0rzw9QvrNctHARnk8k/X5EQ10nIZZA=; b=F5rYl3rFwOJkgDN4Fycz
 JPzvtFRM7btD2ibE8abLUPFnePAhkWKbhjf0ku5gBIIa9mmlNU5sNsWK5/IZZpPLd7qHZYMAAcXx+
 EtJC78XVKHRNJww/jBMg3bSU4ddsRtrR2vBSqwyNxktvvDlLB4lbNkAJ3ZspaF7W5DjMb09+ueuK6
 13dqyiUADsWBfP//qlYPy/vkJnxmnlR78x2jckYKU6n3H9rlCT5Re7BT81YMGYZawIGFdC2xB0VBf
 lEDt9yJ2195Xma0fE7Ac/lrWL2KQ7rZAVcWa+/PoLJglKHanNiY9ooYSZVqYTIUAPcnE2qaKduO3X
 VPOYT2oahn+27w==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1sCQvd-00075P-Vr; Wed, 29 May 2024 17:33:50 -0400
From: Andrea Corallo <acorallo@HIDDEN>
In-Reply-To: <87cyp4wdj7.fsf@HIDDEN> (Philip Kaludercic's message of "Wed, 
 29 May 2024 20:47:56 +0000")
References: <23fd70f8-6e01-45d7-b9f9-d81d53c95ffd@HIDDEN>
 <87cyp4wdj7.fsf@HIDDEN>
Date: Wed, 29 May 2024 17:33:49 -0400
Message-ID: <yp1fru0s3pe.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Philip Kaludercic <philipk@HIDDEN> writes:

> Philippe Schnoebelen <phs@HIDDEN> writes:
>
>> 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 =E2=80=98_i=E2=80=99 not left unused
>>
>> It should be the other way around.
>
> The issue here is that the warning describes an issue in the output, in
> the latter case
>
>   (let* ((_i 1) (--cl-var-- nil))
>     (while (<=3D _i 100)
>       (setq --cl-var-- (cons (random 6) --cl-var--))
>       (setq _i (+ _i 1)))
>     (nreverse --cl-var--))
>
> As you see, _i is both evaluated in (+ _i 1) and updated.
>
> Here you have a minimal working example of the warning:
>
>   (byte-compile (lambda () (let ((_x 3)) _x)))
>
>   ;; Warning: variable =E2=80=98_x=E2=80=99 not left unused
>
> My guess is that fixing this would require cl-loop to notice that the
> counter is prefixed with a "_" and then use some other variable, but
> that might lead to issues with existing code.  Perhaps this
> transformation might be safe in that case:
>
>   (let* ((<fresh-variable> 1) (--cl-var-- nil))
>     (while (<=3D <fresh-variable> 100)
>       (let ((_i <fresh-variable>))
> 	(setq --cl-var-- (cons (random 6) --cl-var--))
> 	(setq <fresh-variable> (+ <fresh-variable> 1))))
>     (nreverse --cl-var--))
>
> I have added Mattias and Stefan to the CCs, as they'll probably have
> more qualified comments to add.

This is the same transformation that came to my mind reading the orginal
report, I think it should be safe.

BTW Philippe, you can workaround the bug with:

(cl-loop repeat 100 collect (random 6))

Bests

  Andrea




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#71120: 29.3; buglet in cl-loop
Resent-From: Andrea Corallo <acorallo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 29 May 2024 21:50:01 +0000
Resent-Message-ID: <handler.71120.B71120.1717019371724 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 71120
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Philip Kaludercic <philipk@HIDDEN>
Cc: 71120 <at> debbugs.gnu.org, Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, Philippe Schnoebelen <phs@HIDDEN>
Received: via spool by 71120-submit <at> debbugs.gnu.org id=B71120.1717019371724
          (code B ref 71120); Wed, 29 May 2024 21:50:01 +0000
Received: (at 71120) by debbugs.gnu.org; 29 May 2024 21:49:31 +0000
Received: from localhost ([127.0.0.1]:56449 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sCRAo-0000Bb-In
	for submit <at> debbugs.gnu.org; Wed, 29 May 2024 17:49:30 -0400
Received: from eggs.gnu.org ([209.51.188.92]:50828)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acorallo@HIDDEN>) id 1sCRAm-0000BG-57
 for 71120 <at> debbugs.gnu.org; Wed, 29 May 2024 17:49:29 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acorallo@HIDDEN>)
 id 1sCRAV-0003HO-4x; Wed, 29 May 2024 17:49:11 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=pDJpNi2hb+n+FtmCJbRKndmHdQ8plg6bXcNsa8ufz04=; b=Ad6uqZo+0ntn1XmWe3w0
 vC0jEYtSqwQRMqGHtNRo8xH/uWPe6rCtJYaHn5T34SiODbyyChhuwh8DLVGf2pXrdyDPPa9JtGsIn
 IXHj+H6pHaCqxDCBwx2aUygoS2d39udcS9n+zpN8/oABGxmR1sdbZc5YVs7fevdxlaW97uBkLPaoo
 Jc/fw/yG7EhejAlQYNIFH+LKYSphm+y0fWPhTPurfCHLa8XJy4SBuVUXyh7TDnBezSzlvl9PCeinD
 s6QXrLqQ2EJRWHI0pnA/uwN2FNt4r6ruwWB6TQTQ3bve/gtmUh4GhtG67Kpbpuq95DVCyDd3Qx8kc
 9e3GnZaUHGeOLg==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1sCRAU-0007ow-FA; Wed, 29 May 2024 17:49:10 -0400
From: Andrea Corallo <acorallo@HIDDEN>
In-Reply-To: <yp1fru0s3pe.fsf@HIDDEN> (Andrea Corallo's message of
 "Wed, 29 May 2024 17:33:49 -0400")
References: <23fd70f8-6e01-45d7-b9f9-d81d53c95ffd@HIDDEN>
 <87cyp4wdj7.fsf@HIDDEN> <yp1fru0s3pe.fsf@HIDDEN>
Date: Wed, 29 May 2024 17:49:10 -0400
Message-ID: <yp1bk4os2zt.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Andrea Corallo <acorallo@HIDDEN> writes:

> Philip Kaludercic <philipk@HIDDEN> writes:
>
>> Philippe Schnoebelen <phs@HIDDEN> writes:
>>
>>> 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 =E2=80=98_i=E2=80=99 not left unused
>>>
>>> It should be the other way around.
>>
>> The issue here is that the warning describes an issue in the output, in
>> the latter case
>>
>>   (let* ((_i 1) (--cl-var-- nil))
>>     (while (<=3D _i 100)
>>       (setq --cl-var-- (cons (random 6) --cl-var--))
>>       (setq _i (+ _i 1)))
>>     (nreverse --cl-var--))
>>
>> As you see, _i is both evaluated in (+ _i 1) and updated.
>>
>> Here you have a minimal working example of the warning:
>>
>>   (byte-compile (lambda () (let ((_x 3)) _x)))
>>
>>   ;; Warning: variable =E2=80=98_x=E2=80=99 not left unused
>>
>> My guess is that fixing this would require cl-loop to notice that the
>> counter is prefixed with a "_" and then use some other variable, but
>> that might lead to issues with existing code.  Perhaps this
>> transformation might be safe in that case:
>>
>>   (let* ((<fresh-variable> 1) (--cl-var-- nil))
>>     (while (<=3D <fresh-variable> 100)
>>       (let ((_i <fresh-variable>))
>> 	(setq --cl-var-- (cons (random 6) --cl-var--))
>> 	(setq <fresh-variable> (+ <fresh-variable> 1))))
>>     (nreverse --cl-var--))
>>
>> I have added Mattias and Stefan to the CCs, as they'll probably have
>> more qualified comments to add.
>
> This is the same transformation that came to my mind reading the orginal
> report, I think it should be safe.

As a datapoint, SBCL does expands this with inside a

(declare (ignore i))

Unfortuantelly we don't support it :/ and our 'ignore' doesn't work here
as goes in the opposite direction :(

  Andrea




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#71120: 29.3; buglet in cl-loop
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 30 May 2024 01:46:02 +0000
Resent-Message-ID: <handler.71120.B71120.17170335451138 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 71120
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Andrea Corallo <acorallo@HIDDEN>
Cc: 71120 <at> debbugs.gnu.org, Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>, Philip Kaludercic <philipk@HIDDEN>, Philippe Schnoebelen <phs@HIDDEN>
Received: via spool by 71120-submit <at> debbugs.gnu.org id=B71120.17170335451138
          (code B ref 71120); Thu, 30 May 2024 01:46:02 +0000
Received: (at 71120) by debbugs.gnu.org; 30 May 2024 01:45:45 +0000
Received: from localhost ([127.0.0.1]:38425 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sCUrR-0000IH-Fo
	for submit <at> debbugs.gnu.org; Wed, 29 May 2024 21:45:45 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:43181)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1sCUrP-0000Hy-R5
 for 71120 <at> debbugs.gnu.org; Wed, 29 May 2024 21:45:44 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id CDC54100043;
 Wed, 29 May 2024 21:45:27 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1717033526;
 bh=t1efKYalRZ2LE9l4ZxgP5CHNT3lBAhC3xpSLRC8g83k=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=jdA9RD0cdeFgchIERnMa/afjLboZLJT6Fqr0CzbYlQ4Rtit+cPe2qYPEWNk3PkTRN
 5u6IAHikA3Ly02uDYO8hSEuvLXwBkLX1/LtXRkJeoyArmFSCwaCsPNmQD+kmuxIvEK
 lDKGFKuPGWMQ/tBM9wEqrcEKlcADCKCGZJrFAQf81WbzTKj9c4Q2qls2hZSZQ+MoAf
 eNx7DCFOOgd6GP4MRmXKbIKs6h/z7sF7SU8oUvjpuxftGGuuchr1R9ai/Nh+byWiCM
 n5HcnhPYKuXAUT+fvArzeUsDie+qAjbb1Nk3U4zU+WETSOVmyvD9pYCtErVYk/FJ+8
 SiAM2f4X8YCaw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E19A410002E;
 Wed, 29 May 2024 21:45:26 -0400 (EDT)
Received: from pastel (unknown [24.140.236.196])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A7321120209;
 Wed, 29 May 2024 21:45:26 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <yp1fru0s3pe.fsf@HIDDEN> (Andrea Corallo's message of
 "Wed, 29 May 2024 17:33:49 -0400")
Message-ID: <jwvr0dkyt4q.fsf-monnier+emacs@HIDDEN>
References: <23fd70f8-6e01-45d7-b9f9-d81d53c95ffd@HIDDEN>
 <87cyp4wdj7.fsf@HIDDEN> <yp1fru0s3pe.fsf@HIDDEN>
Date: Wed, 29 May 2024 21:45:26 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.759 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>>   (let* ((<fresh-variable> 1) (--cl-var-- nil))
>>     (while (<= <fresh-variable> 100)
>>       (let ((_i <fresh-variable>))
>> 	(setq --cl-var-- (cons (random 6) --cl-var--))
>> 	(setq <fresh-variable> (+ <fresh-variable> 1))))
>>     (nreverse --cl-var--))
>>
>> I have added Mattias and Stefan to the CCs, as they'll probably have
>> more qualified comments to add.

Not really: There's a similar problem with `cl-destructuring-bind` and
similarly, when I started to look at the corresponding code I quickly
gave up.

At least for `cl-destructuring-bind` I think I understand the intended
behavior well enough that I might be able to implement code which
behaves as we want (tho I don't know how to *modify* the existing code
to reach that stage).

In the case of `cl-loop` the intended behavior is much too complex for
my poor head, so I don't think I'd be able to decide whether it does the
right thing for all cases.


        Stefan





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#71120: 29.3; buglet in cl-loop
Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 30 May 2024 09:28:02 +0000
Resent-Message-ID: <handler.71120.B71120.17170612304732 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 71120
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Philip Kaludercic <philipk@HIDDEN>
Cc: 71120 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>, Philippe Schnoebelen <phs@HIDDEN>
Received: via spool by 71120-submit <at> debbugs.gnu.org id=B71120.17170612304732
          (code B ref 71120); Thu, 30 May 2024 09:28:02 +0000
Received: (at 71120) by debbugs.gnu.org; 30 May 2024 09:27:10 +0000
Received: from localhost ([127.0.0.1]:54537 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sCc3w-0001EB-Ss
	for submit <at> debbugs.gnu.org; Thu, 30 May 2024 05:27:09 -0400
Received: from mail-lf1-f53.google.com ([209.85.167.53]:42475)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1sCc3s-0001DJ-Mt
 for 71120 <at> debbugs.gnu.org; Thu, 30 May 2024 05:27:06 -0400
Received: by mail-lf1-f53.google.com with SMTP id
 2adb3069b0e04-52b27afe214so529996e87.1
 for <71120 <at> debbugs.gnu.org>; Thu, 30 May 2024 02:26:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1717061148; x=1717665948; darn=debbugs.gnu.org;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject
 :date:message-id:reply-to;
 bh=richXStWpQmZRwglxZD4hnPzeDk40fkGpMF3e4bTS3I=;
 b=Ex/xZ/4QAMxFEj9xNtUbbJ9rZY3nIQBO7aDqo/KxDiDQeTm7IL+7I3aqK/QJ4VCEyC
 36vrn1XZYkqlIE4462Hvswu9oNnUCoJMGnm+lcBpzExNDbsoezUMMtxmnF2yzJOTMNbK
 iIwRkAWcRRHkbcm8x/i1ukjoKCJEMn9kY4oOgm8JTY88alYew2XAy5aF+IjROUdEjmHI
 654T0a0qk6TmUaTYwcpDNcoQiXesdWVjPtHh2D5kCHRS+ysJdE61kiqMFa9cpNN01SXN
 NQyvVxom3VF0yi5KY9PWv1JMnNR24SsdDo2NfO0zphhSJ82oMnEnW/Z0HKAfDtu3t1XV
 twAA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1717061148; x=1717665948;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:sender:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=richXStWpQmZRwglxZD4hnPzeDk40fkGpMF3e4bTS3I=;
 b=rn2mCnT5Tidrv8ZU78C96QYV2BiAg0g9sU3NPR/2svouWcX40ARNZya73Uipi7s3iI
 f9vt0xDA6Cho2lq31cDg6h7n4L66HXULt9uuWYuUyFWc8kfhs/eilXzS/Djj2FET5jy/
 5+vyJrOun5p2/uatPi2y+LDTPI17KY3Ix8O+QVwEHyC2BzCLlUo4JH8JgEaI2ES1Kkbr
 7/Dc2SAxwYMg9RqpOPxfZtRIOnOvIWeQvA5Jrk7X11aM1EGy5gYPcGG7cbnZpni1mZfB
 yZhz8Uj9AniChZ/IQDGBwSvFyRpUBuejVN1UJF2hiB6u3a4hnvqQZiOQ/iBznXoZa79P
 wjcQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCWnHDfVrZeU4A8BmSlSaPov43Fch2avQDIa3KtHkNN/UIUxgj4AlAbpYPyKZvI+zONxNERq3/tfGz0W0Iglg4mFvvkDuh4=
X-Gm-Message-State: AOJu0YzJHcurBRhPplD80a7dCimW0/oJTmcrkV3fi616x/o0DF6+ZjTT
 QMTLr8eTEj5qPwZ6FHYGb2kuzUi6aeFyNSevRrYHnItKFZDRw2T3
X-Google-Smtp-Source: AGHT+IGMUsF8opmDCSZOpZMCrpGLfmxvKrGOAMwvglrbgR5EdZfFRe5aIZWKhAL7zG3FLJUcWULo1A==
X-Received: by 2002:a05:6512:344e:b0:524:4a7:5f1 with SMTP id
 2adb3069b0e04-52b7e0ee8a4mr420986e87.2.1717061147846; 
 Thu, 30 May 2024 02:25:47 -0700 (PDT)
Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se.
 [80.217.1.132]) by smtp.gmail.com with ESMTPSA id
 2adb3069b0e04-529b5ed674bsm1014417e87.18.2024.05.30.02.25.47
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 30 May 2024 02:25:47 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <87cyp4wdj7.fsf@HIDDEN>
Date: Thu, 30 May 2024 11:25:46 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <4ED83CF1-C697-46DF-99D2-56432A1E3B44@HIDDEN>
References: <23fd70f8-6e01-45d7-b9f9-d81d53c95ffd@HIDDEN>
 <87cyp4wdj7.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philippe Schnoebelen <phs@HIDDEN> writes:

> When I need a list of 100 random dice throws I write
>=20
> 	(cl-loop for i from 1 to 100 collect (random 6))
>=20
> It compiles just fine.
>=20
> If instead I use
>=20
> 	(cl-loop for _i from 1 to 100 collect (random 6))
>=20
> then I get a compilation warning:
>=20
> 	foo.el:1:18: Warning: variable =E2=80=98_i=E2=80=99 not left =
unused

Quite unfair that you have no a priori way of knowing whether your =
variable name is actually the one that `cl-loop` uses for iteration or =
just one bound for each iteration (as in `dotimes`).

A sloppy reading of Common Lisp's `loop` spec, which we don't need to =
follow since this isn't CL but we'd be fools to deviate too far from =
without a good reason, didn't tell me anything.

In particular nothing about whether the user is allowed to alter the =
variable in order to change the iteration. For example, what should

  (cl-loop for i from 1 to 100
           when (=3D i 3) do (setq i 98)
           collect i)

return? Perhaps better not touch that.

Thus I don't think there's anything we really need to do here, do you?





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#71120: 29.3; buglet in cl-loop
Resent-From: Andrea Corallo <acorallo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 30 May 2024 13:15:02 +0000
Resent-Message-ID: <handler.71120.B71120.1717074885387 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 71120
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
Cc: 71120 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, Philippe Schnoebelen <phs@HIDDEN>
Received: via spool by 71120-submit <at> debbugs.gnu.org id=B71120.1717074885387
          (code B ref 71120); Thu, 30 May 2024 13:15:02 +0000
Received: (at 71120) by debbugs.gnu.org; 30 May 2024 13:14:45 +0000
Received: from localhost ([127.0.0.1]:35054 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sCfcC-00006A-Sv
	for submit <at> debbugs.gnu.org; Thu, 30 May 2024 09:14:45 -0400
Received: from eggs.gnu.org ([209.51.188.92]:52166)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acorallo@HIDDEN>) id 1sCfcA-00005n-0C
 for 71120 <at> debbugs.gnu.org; Thu, 30 May 2024 09:14:43 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acorallo@HIDDEN>)
 id 1sCfbt-0007Er-BS; Thu, 30 May 2024 09:14:25 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=QUptmOyDq7A5bWvlnKcGADZ3rgvuo94Fz5HtlW6vdmw=; b=IGBqEgQAHZDNTXdeTEiY
 RuPSa6pvbtPW4cvJ0Eu+tIaaDsbWYklAOuBQd1G+uj4Tlba957AQV6zz7ZUQCbOUWuf6okENQxOdu
 3D6u3gmBqu0waOSvoNuDlDpQDfunltbs2drwlxRAqpZ5Theq83LTTjcVgaCVmrdEaUt9cD09hMN57
 MaseMkbvuTDChFyxQK65O4QjDUKcjsCo/nC+jXMT5Z12TvnNOkIfOfL/HKWjJsEPadEi7gRVSWAaa
 DNAVbBmZF5VKfJpfo3WXXVBqfZLu5DHXSopnFGdbh4FvMRwY721uDUEm1OZFh1WYutm3RmgM0rESQ
 4uOogkKnEcGjDA==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1sCfbt-0006mF-0u; Thu, 30 May 2024 09:14:25 -0400
From: Andrea Corallo <acorallo@HIDDEN>
In-Reply-To: <4ED83CF1-C697-46DF-99D2-56432A1E3B44@HIDDEN> ("Mattias
 =?UTF-8?Q?Engdeg=C3=A5rd?="'s message of "Thu, 30 May 2024 11:25:46
 +0200")
References: <23fd70f8-6e01-45d7-b9f9-d81d53c95ffd@HIDDEN>
 <87cyp4wdj7.fsf@HIDDEN>
 <4ED83CF1-C697-46DF-99D2-56432A1E3B44@HIDDEN>
Date: Thu, 30 May 2024 09:14:24 -0400
Message-ID: <yp1le3rqw5r.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Mattias Engdeg=C3=A5rd <mattias.engdegard@HIDDEN> writes:

> Philippe Schnoebelen <phs@HIDDEN> writes:
>
>> When I need a list of 100 random dice throws I write
>>=20
>> 	(cl-loop for i from 1 to 100 collect (random 6))
>>=20
>> It compiles just fine.
>>=20
>> If instead I use
>>=20
>> 	(cl-loop for _i from 1 to 100 collect (random 6))
>>=20
>> then I get a compilation warning:
>>=20
>> 	foo.el:1:18: Warning: variable =E2=80=98_i=E2=80=99 not left unused
>
> Quite unfair that you have no a priori way of knowing whether your variab=
le name is actually the one that `cl-loop` uses for iteration or just one b=
ound for each iteration (as in `dotimes`).
>
> A sloppy reading of Common Lisp's `loop` spec, which we don't need to fol=
low since this isn't CL but we'd be fools to deviate too far from without a=
 good reason, didn't tell me anything.
>
> In particular nothing about whether the user is allowed to alter the vari=
able in order to change the iteration. For example, what should
>
>   (cl-loop for i from 1 to 100
>            when (=3D i 3) do (setq i 98)
>            collect i)
>
> return? Perhaps better not touch that.

If the spec doesn't say anything usually means it's left to the
implementors (IOW it's UB).

> Thus I don't think there's anything we really need to do here, do you?

I, for one, think the nicest option is the one SBCL (and I guess other
CL implementations) are using, that is to have 'i' 'ignorable', the
problem is that we don't support this at language level.

  Andrea





Last modified: Thu, 30 May 2024 13:30:03 UTC

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