emacs-devel
[Top][All Lists]
Advanced

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

Re: convert-standard-filename on w32 does not preserve match-data?


From: Stefan Monnier
Subject: Re: convert-standard-filename on w32 does not preserve match-data?
Date: Mon, 25 Dec 2006 18:19:57 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux)

>     No, I think instead that code that calls convert-standard-filename
>     shouldn't expect it to preserve the match-data.

> It seems cleaner to me for a general subroutine, that does a job not
> specifically related to searching or matching, to preserve the match
> data, rather than making all its callers take care.

Until now the way things have worked apparently is:

  any function that is not a "simple builtin" does not need to save the
  match data.

Now what is a "simple builtin" is not clearly specified anywhere, but
I wouldn't expect convert-standard-filename to be one.

The main reason for limiting the number of functions that preserve the match
data is that, on the one hand save-match-data is a relatively costly
operation, and on the other, 99% of the uses of the match-data is
immediately after a regex-match, with very few operations in-between (if
any), so it's much more efficient performancewise and programmerwise to
place the save-match-data at the few places where the use of the match data
does not come immediately after the regexp-match, than to place around each
and every function that's not obviously related to searching or matching
(i.e. a majority of the functions).


        Stefan




reply via email to

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