unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#37943: assoc-default is wrongly flagged as side-effect-free.
@ 2019-10-27 12:24 Alan Mackenzie
  2019-10-28 15:24 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Mackenzie @ 2019-10-27 12:24 UTC (permalink / raw)
  To: 37943

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#37943: assoc-default is wrongly flagged as side-effect-free.
  2019-10-27 12:24 bug#37943: assoc-default is wrongly flagged as side-effect-free Alan Mackenzie
@ 2019-10-28 15:24 ` Lars Ingebrigtsen
  2020-08-25 23:32   ` Stefan Kangas
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-28 15:24 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 37943

Alan Mackenzie <acm@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#37943: assoc-default is wrongly flagged as side-effect-free.
  2019-10-28 15:24 ` Lars Ingebrigtsen
@ 2020-08-25 23:32   ` Stefan Kangas
  2020-08-26  9:28     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Kangas @ 2020-08-25 23:32 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Alan Mackenzie, 37943

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Alan Mackenzie <acm@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#37943: assoc-default is wrongly flagged as side-effect-free.
  2020-08-25 23:32   ` Stefan Kangas
@ 2020-08-26  9:28     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-26  9:28 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Alan Mackenzie, 37943

Stefan Kangas <stefan@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-26  9:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-27 12:24 bug#37943: assoc-default is wrongly flagged as side-effect-free Alan Mackenzie
2019-10-28 15:24 ` Lars Ingebrigtsen
2020-08-25 23:32   ` Stefan Kangas
2020-08-26  9:28     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).