emacs-devel
[Top][All Lists]
Advanced

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

Re: find-file-noselect needs save-match-data


From: martin rudalics
Subject: Re: find-file-noselect needs save-match-data
Date: Fri, 08 Jun 2007 11:42:03 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> It's quite the opposite IMO.  "safe" can mean many things, whereas
> "nodata" clearly indicates that it doesn't set (or modify) match-data.

"-nodata" is good.

> But in practice, we should have a macro to encapsulate calls:
>
>     (preserve-match-data (string-match ...))

This would violate referential transparency.  Consider

(defvar foobar "foobar")

(defun foo ()
  (string-match "foo" foobar)
  (match-string 0 foobar))

(defun bar ()
  (string-match "bar" foobar)
  (preserve-match-data
   (foo)))





reply via email to

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