[Top][All Lists]

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

Re: Discrepancy in definition/use of match-data?

From: Richard Stallman
Subject: Re: Discrepancy in definition/use of match-data?
Date: Fri, 11 Jun 2004 21:51:06 -0400

    Now the obvious solution to that would be to make unsuccessful
    matches void the match-data, too.

That might be a good thing to do, except that doing it now is likely
to delay the release.

    So my proposal is the following plan:

    Before next release:
    match-data gets voided upon entry of a filter or sentinel, like it is
    being done now.  With void match-data, match-beginning and so on flag
    an error irrespective of their argument.  The match-data is only
    touched by a successful match.  Once a match has been successful,
    match-beginning and so on will not flag errors for positive
    arguments, but return nil (as documented).

    In order to have a better chance of catching such
    use-before-valid-match situations, it might be a good idea also to
    void the match-data in the main loop.

Voiding in the main loop was exactly the idea that occurred to me.
So let's do all of this now.

    After the next release, I would like to have unsuccessful matches
    also void the match-data, making the use of the above quoted idiom

I agree.  (But please, let's say "cause an error", not "illegal".
Nobody is going to be jailed for doing this.)

    We should do this change right after the next release so that Emacs
    core developers and those for add-on packages have enough time testing
    it, finding the problematic code and fixing it for the next release
    after that.

We could do it right now in the Unicode branch.  That way, we'd assure
it will get into the following major release, but detection of code
that needs changing could start right away.

reply via email to

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