[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `match-data' set improperly
From: |
Kim F. Storm |
Subject: |
Re: `match-data' set improperly |
Date: |
13 Feb 2003 13:25:16 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
"Matt Swift" <swift@alum.mit.edu> writes:
> I stand corrected.
>
> Nevertheless I see a strong case for revising both the documentation and the
> behavior of the function.
I have fixed the documentation for match-data, so that it explicitly
states that the return value is undefined if the last search failed.
I don't see a strong reason to change the behaviour; it's worked like this
for many years, so people seem to be able to cope with it.
I think the code is generally easier to understand if there is an
explicit test on the return value of the search command.
On the other hand, I don't object (but I'm not the one to decide!!) to
changing this behaviour in the way you suggest (i.e. make the various
match-* functions return nil if the last search failed).
Maybe you can write a patch (it can be isolated to search.c I think),
so we can see what's needed?
> The second sentence you quote is almost meaningless. "did not do
> this" -- did not do WHAT? alter it, or not alter it? Likewise, one
> cannot tell what might be changed to what in the future.
At least it cleary (:-)) indicates that you should not rely on the
return value, neither now, nor in the future.
--
Kim F. Storm http://www.cua.dk