unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Saving match data
Date: Fri, 16 Jun 2017 15:53:03 -0400	[thread overview]
Message-ID: <jwvmv97d89i.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAArVCkQ_tzcosP_zDDRxm1iNox2t1PTYz5jrM-qA5TYv4xAsNQ@mail.gmail.com> (Philipp Stephani's message of "Fri, 16 Jun 2017 19:24:01 +0000")

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

Indeed.

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


        Stefan



  reply	other threads:[~2017-06-16 19:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28 14:01 Saving match data Philipp Stephani
2016-09-28 15:03 ` Eli Zaretskii
2016-09-28 16:11 ` Stefan Monnier
2016-09-28 16:49   ` Michael Heerdegen
2016-09-28 18:25     ` Stefan Monnier
2016-09-28 18:37       ` Michael Heerdegen
2016-09-28 20:00     ` Eli Zaretskii
2016-09-28 20:15       ` Michael Heerdegen
2016-09-28 20:22         ` Eli Zaretskii
2016-09-28 20:42           ` Michael Heerdegen
2016-09-28 20:58             ` Lars Ingebrigtsen
2016-09-29  2:36             ` Eli Zaretskii
2016-10-08  4:02               ` Michael Heerdegen
2016-10-08  6:25                 ` Eli Zaretskii
2016-10-08 15:06                 ` Stefan Monnier
2017-06-16 19:24   ` Philipp Stephani
2017-06-16 19:53     ` Stefan Monnier [this message]
2017-06-16 22:16       ` Philipp Stephani
2017-06-17 13:53         ` Stefan Monnier
2017-06-17 14:02           ` Philipp Stephani
2017-10-08 15:56             ` Philipp Stephani
2017-10-08 16:01       ` Philipp Stephani
2016-09-28 17:00 ` Marcin Borkowski
2016-09-29  9:29   ` Uwe Brauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvmv97d89i.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).