emacs-devel
[Top][All Lists]
Advanced

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

Saving match data


From: Philipp Stephani
Subject: Saving match data
Date: Wed, 28 Sep 2016 14:01:23 +0000

Hi,

the Elisp manual (section "The Match Data") says:

"Notice that all functions are allowed to overwrite the match data
unless they’re explicitly documented not to do so."

I think this statement is surprising and puts unnecessary burden on Elisp programmers. The usual expectation is that global state is *not* modified unless explicitly specified. Taken literally, Elisp programmers need to surround even calls to `car' with `save-match-data' because the documentation of `car' doesn't specify that it doesn't change the match data. How about changing the statement to

"Notice that no functions are allowed to overwrite the match data unless they're explicitly documented to do so."

and then clean up existing documentation and add `save-match-data' where appropriate.

Philipp

reply via email to

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