GNU bug report logs - #37943
assoc-default is wrongly flagged as side-effect-free.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Sun, 27 Oct 2019 12:26:02 UTC

Severity: normal

Tags: fixed

Fixed in version 28.1

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 37943 in the body.
You can then email your comments to 37943 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#37943; Package emacs. (Sun, 27 Oct 2019 12:26:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 27 Oct 2019 12:26:04 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: bug-gnu-emacs <at> gnu.org
Subject: assoc-default is wrongly flagged as side-effect-free.
Date: Sun, 27 Oct 2019 12:24:55 +0000
Hello, Emacs.

Emacs 27.

In the source for assoc-default (in subr.el) appears

    (declare (side-effect-free t))

.  This is not true when the TEST argument to assoc-default itself
changes the match-data.

I suggest removing this declaration from the function rather than
amending the code with a save-match-data.  There are calls to
assoc-default in set-auto-mode where the caller relies on the match data
set by the function when TEST is string-match.  :-(

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37943; Package emacs. (Mon, 28 Oct 2019 15:25:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 37943 <at> debbugs.gnu.org
Subject: Re: bug#37943: assoc-default is wrongly flagged as side-effect-free.
Date: Mon, 28 Oct 2019 16:24:32 +0100
Alan Mackenzie <acm <at> muc.de> writes:

> In the source for assoc-default (in subr.el) appears
>
>     (declare (side-effect-free t))
>
> .  This is not true when the TEST argument to assoc-default itself
> changes the match-data.
>
> I suggest removing this declaration from the function rather than
> amending the code with a save-match-data.  There are calls to
> assoc-default in set-auto-mode where the caller relies on the match data
> set by the function when TEST is string-match.  :-(

Yeah, I don't think any function that takes a closure as an argument
should be marked side-effect free?  The TEST function can side-effect as
much as it wants.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37943; Package emacs. (Tue, 25 Aug 2020 23:33:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Alan Mackenzie <acm <at> muc.de>, 37943 <at> debbugs.gnu.org
Subject: Re: bug#37943: assoc-default is wrongly flagged as side-effect-free.
Date: Tue, 25 Aug 2020 16:32:45 -0700
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Alan Mackenzie <acm <at> muc.de> writes:
>
>> In the source for assoc-default (in subr.el) appears
>>
>>     (declare (side-effect-free t))
>>
>> .  This is not true when the TEST argument to assoc-default itself
>> changes the match-data.
>>
>> I suggest removing this declaration from the function rather than
>> amending the code with a save-match-data.  There are calls to
>> assoc-default in set-auto-mode where the caller relies on the match data
>> set by the function when TEST is string-match.  :-(
>
> Yeah, I don't think any function that takes a closure as an argument
> should be marked side-effect free?  The TEST function can side-effect as
> much as it wants.

No further replies within 43 weeks.

Should we just go ahead and remove it then?  No one seems to be
objecting.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37943; Package emacs. (Wed, 26 Aug 2020 09:30:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Alan Mackenzie <acm <at> muc.de>, 37943 <at> debbugs.gnu.org
Subject: Re: bug#37943: assoc-default is wrongly flagged as side-effect-free.
Date: Wed, 26 Aug 2020 11:28:56 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> Should we just go ahead and remove it then?  No one seems to be
> objecting.

Yup.  I've now done so on the trunk.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 26 Aug 2020 09:30:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 37943 <at> debbugs.gnu.org and Alan Mackenzie <acm <at> muc.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 26 Aug 2020 09:30: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. (Wed, 23 Sep 2020 11:24:09 GMT) Full text and rfc822 format available.

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

Previous Next


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