[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving match data

From: Stefan Monnier
Subject: Re: Saving match data
Date: Fri, 16 Jun 2017 15:53:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

>> > I think this statement is surprising
>> Agreed.  That's why we have to write it explicitly in the doc ;-)
> Could we also write it in the docstrings of the match-related functions
> (match-beginning etc.)? I guess people are more likely to read those than
> the manual.

That might work, yes (tho in my experience, Elisp coder don't read
docstrings nearly as much as I would have expected).

>> Indeed, there's also an expectation that "primitives" don't touch the
>> match-data.  It would be good to document it, tho it will take some work
>> to clarify what is meant by "primitive".
> At least all functions that are side-effect-free or pure (in the sense of
> byte-opt) are trivially in this category, so we could amend the help texts
> of these functions automatically.


> (Looking at that list, I'm wondering why so few functions are marked as
> pure - e.g. even `eq' is apparently not pure?)

I don't think there's a good reason for that.  Just lack of need so far.

> It would also come with the obvious result of making the Emacs function
> contracts much clearer because they wouldn't modify global state any more.

Some still would (as long as the match-data is a global state).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]