[Top][All Lists]

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

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

From: Herbert Euler
Subject: Re: find-file-noselect needs save-match-data
Date: Sat, 16 Jun 2007 11:50:56 +0800

I fail to see the simplicity. All the difficulty comes from having to think
about when to be careful about the match-data.

What we currently have is a model that each call to the matching
functions such as `string-match', `looking-at' etc changes the
match-data.  Furthermore, almost any function calls one of these
functions.  So with this model thinking about preserving match-data is
extravagant, since after each call to almost any function, the
match-data is possibly changed.  This means that you can't expect the
match-data is preserved even if there is only one simple invocation to
some function between the positions where the matching functions are
called and where the match-data is used, unless the invocation is
inside a `save-match-data' form.

If, for example, we add some function such as `fast-string-match', or
add some variable such as `inhibit-match-data', this actually doesn't
help solve the problem.  Since changing match-data is possible by
calling matching functions (although achieving it is a bit difficult
compared with the usage now), match-data is not guaranteed not to be
changed, just as before.

So with the current model, the only way to preserve match-data is to
use the `save-match-data' form everywhere, which is impratical.

But we can't make match-data unchanged, so there seems no solution to
this problem, and just as Stefan said, this is a non-problem.

Guanpeng Xu

Don't just search. Find. Check out the new MSN Search! http://search.msn.com/

reply via email to

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