GNU bug report logs - #31232
27.0.50; Obsolete argument RESULT in the macro `dotimes'

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Sat, 21 Apr 2018 20:58:02 UTC

Severity: minor

Merged with 16206, 39919, 41287

Found in versions 24.3, 26.3, 28.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31232 in the body.
You can then email your comments to 31232 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#31232; Package emacs. (Sat, 21 Apr 2018 20:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 21 Apr 2018 20:58:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; Obsolete argument RESULT in the macro `dotimes'
Date: Sat, 21 Apr 2018 23:53:44 +0300
If the arg RESULT of dotimes is not yet deprecated,
then to legitimize its usage it needs to be fixed.
At least, this patch tries to do this (maybe not in the best way):

diff --git a/lisp/subr.el b/lisp/subr.el
index 9cf7d59..aa2dc49 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -246,8 +246,8 @@ dotimes
                  ,@body)
                (setq ,counter (1+ ,counter)))
              ,@(if (cddr spec)
-                   ;; FIXME: This let often leads to "unused var" warnings.
-                   `((let ((,(car spec) ,counter)) ,@(cddr spec))))))
+                   ;; No-op ,(car spec) is added to avoid "unused var" warnings.
+                   `((let ((,(car spec) ,counter)) ,(car spec) ,@(cddr spec))))))
       `(let ((,temp ,end)
              (,(car spec) ,start))
          (while (< ,(car spec) ,temp)




Merged 16206 31232. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 21 Apr 2018 23:20:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31232; Package emacs. (Sun, 22 Apr 2018 00:23:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 31232 <at> debbugs.gnu.org
Subject: Re: bug#31232: 27.0.50;
 Obsolete argument RESULT in the macro `dotimes'
Date: Sat, 21 Apr 2018 20:22:37 -0400
Juri Linkov wrote:

> If the arg RESULT of dotimes is not yet deprecated,
> then to legitimize its usage it needs to be fixed.

Or, simply document that RESULT should not be used unless it makes use
of VAR, as suggested in https://debbugs.gnu.org/16206#8 .




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 27 May 2018 11:24:05 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Michael Heerdegen <michael_heerdegen <at> web.de> to control <at> debbugs.gnu.org. (Tue, 28 Apr 2020 02:33:02 GMT) Full text and rfc822 format available.

bug No longer marked as fixed in versions 27.0.50 and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 28 Apr 2020 02:33:02 GMT) Full text and rfc822 format available.

Merged 16206 31232 39919. Request was from Michael Heerdegen <michael_heerdegen <at> web.de> to control <at> debbugs.gnu.org. (Tue, 28 Apr 2020 02:38:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31232; Package emacs. (Tue, 28 Apr 2020 02:53:02 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Mike Woolley <mike <at> bulsara.com>
Cc: 39919 <at> debbugs.gnu.org, 31232 <at> debbugs.gnu.org, rms <at> gnu.org
Subject: Re: bug#39919: 26.3; Incorrect byte-compiler warning
Date: Tue, 28 Apr 2020 04:52:24 +0200
Mike Woolley <mike <at> bulsara.com> writes:

> Yes that fixes the issue in the test cases I sent.
> Also looks good in my real code where I noticed the problem!

Seems the current warning is a compromise.  It is not perfect because it
is not really clear what the warning means.  I would vote for a clear
"argument is deprecated" warning.

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31232; Package emacs. (Tue, 28 Apr 2020 16:36:02 GMT) Full text and rfc822 format available.

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

From: Mike Woolley <mike <at> bulsara.com>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 39919 <at> debbugs.gnu.org, 31232 <at> debbugs.gnu.org, rms <at> gnu.org
Subject: Re: bug#39919: 26.3; Incorrect byte-compiler warning 
Date: Tue, 28 Apr 2020 17:35:47 +0100
[Message part 1 (text/plain, inline)]
I think people using `dotimes' from `cl’ are going to expect it to work like in Common Lisp (as that’s the whole point).

Just deprecating the result parameter because it’s too hard doesn’t seem like a good solution :-)

Thanks,
Mike

> On 28 Apr 2020, at 03:52, Michael Heerdegen <michael_heerdegen <at> web.de> wrote:
> 
> Mike Woolley <mike <at> bulsara.com> writes:
> 
>> Yes that fixes the issue in the test cases I sent.
>> Also looks good in my real code where I noticed the problem!
> 
> Seems the current warning is a compromise.  It is not perfect because it
> is not really clear what the warning means.  I would vote for a clear
> "argument is deprecated" warning.
> 
> Michael.

[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31232; Package emacs. (Tue, 28 Apr 2020 18:09:01 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Mike Woolley <mike <at> bulsara.com>
Cc: 39919 <at> debbugs.gnu.org, 31232 <at> debbugs.gnu.org, rms <at> gnu.org
Subject: Re: bug#39919: 26.3; Incorrect byte-compiler warning
Date: Tue, 28 Apr 2020 20:08:11 +0200
Mike Woolley <mike <at> bulsara.com> writes:

> I think people using `dotimes' from `cl’ are going to expect it to
> work like in Common Lisp (as that’s the whole point).

But note that dotimes is in subr.el, and cl-dotimes is separate (though
it's currently implemented on top of dotimes).

> Just deprecating the result parameter because it’s too hard doesn’t
> seem like a good solution :-)

I regret that I said it like that, no, that's not a reason.  The main
reason is that the whole existence (usefulness) of the RESULT argument
and its position in the syntax are questionable.

Michael.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31232; Package emacs. (Tue, 28 Apr 2020 18:50:01 GMT) Full text and rfc822 format available.

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

From: Mike Woolley <mike <at> bulsara.com>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 39919 <at> debbugs.gnu.org, 31232 <at> debbugs.gnu.org, rms <at> gnu.org
Subject: Re: bug#39919: 26.3; Incorrect byte-compiler warning 
Date: Tue, 28 Apr 2020 19:48:49 +0100
Thanks for the explanation Michael.

How about changing dotimes as you suggested, but making cl-dotimes have it’s own implementation with the result parameter fix applied? 

Then everyone’s a winner - those who want the CL behaviour can have it, but core Emacs will have a cleaner version.

Thanks,
Mike

> On 28 Apr 2020, at 19:13, Michael Heerdegen <michael_heerdegen <at> web.de> wrote:
> 
> Mike Woolley <mike <at> bulsara.com> writes:
> 
>> I think people using `dotimes' from `cl’ are going to expect it to
>> work like in Common Lisp (as that’s the whole point).
> 
> But note that dotimes is in subr.el, and cl-dotimes is separate (though
> it's currently implemented on top of dotimes).
> 
>> Just deprecating the result parameter because it’s too hard doesn’t
>> seem like a good solution :-)
> 
> I regret that I said it like that, no, that's not a reason.  The main
> reason is that the whole existence (usefulness) of the RESULT argument
> and its position in the syntax are questionable.
> 
> Michael.
> 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31232; Package emacs. (Tue, 28 Apr 2020 20:15:02 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Mike Woolley <mike <at> bulsara.com>
Cc: 39919 <at> debbugs.gnu.org, 31232 <at> debbugs.gnu.org, rms <at> gnu.org
Subject: Re: bug#39919: 26.3; Incorrect byte-compiler warning
Date: Tue, 28 Apr 2020 22:14:00 +0200
Mike Woolley <mike <at> bulsara.com> writes:

> Thanks for the explanation Michael.
>
> How about changing dotimes as you suggested, but making cl-dotimes
> have it’s own implementation with the result parameter fix applied?
>
> Then everyone’s a winner - those who want the CL behaviour can have
> it, but core Emacs will have a cleaner version.

Exactly my idea after thinking about what I had written :-)

Michael.




Merged 16206 31232 39919 41287. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Fri, 15 May 2020 14:28:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31232; Package emacs. (Wed, 30 Sep 2020 18:32:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Christopher Wellons <wellons <at> nullprogram.com>, 31232 <at> debbugs.gnu.org,
 16206 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#16206: 24.3; Incorrect unused variable byte-compiler
 warning in dotimes
Date: Wed, 30 Sep 2020 20:31:20 +0200
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

>> But without that addition the sentence makes no sense when
>> the documentation describes the RESULT argument and then
>> at the end says that "RESULT should not be used".
>
> "Its use is deprecated".

I've touched it up further -- I thought it was unclear what "it" was
referring to, and I've now also mentioned that using it may result in
byte compilation warnings.

With that change, I don't think there's anything more to fix here.  It
was mentioned that perhaps cl-dotimes should have a different
implementation, but I, too, think the RESULT bit is awkward, so I don't
think it's worth it.  So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 31232 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 30 Sep 2020 18:32:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Oct 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 151 days ago.

Previous Next


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