emacs-devel
[Top][All Lists]
Advanced

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

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


From: Stephen J. Turnbull
Subject: Re: Discrepancy in definition/use of match-data?
Date: Sat, 12 Jun 2004 15:45:51 +0900
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.5 (chayote, linux)

>>>>> "David" == David Kastrup <address@hidden> writes:

    David> How strong were the results from the regression test?

What does that mean?  There is one test that specifically checks for
match-data being preserved across a failed match, and it failed.

    David> What kind and amount of code appears to be affected?

Kind?  I know of one specific use in `w3-configuration-data' in
w3-cfg.el which calls itself recursively, and depends on being able to
use the top-level match-data if the match in the recursive call fails,
while using the match-data from the recursive call otherwise.  Too
sneaky to live, I suppose you could say.

Amount?  How should I know?  I can say I've tried inserting warning
code in match_limit and file-name-sans-extension produces the warning
during the dump phase.  I don't know why yet, my implementation may be
incorrect (the flag is either getting reset when it shouldn't, or
fails to get set on a successful search---the Boyer-Moore code is the
most complicated thing I've ever tried to deal with).

However, I know that file-handlers can get called there, via
file-name-directory inter alia.  In general, even a simple variable
reference can call arbitrary Lisp code in XEmacs (because of magic
Mule handlers) and most likely GNU Emacs (because those handlers were
introduced for GNU Emacs compatibility).

    David> With the current code.  But I was also proposing to void
    David> the match-data in the main loop: that would produce errors
    David> more often, and only in situations where the match-data was
    David> completely unpredictable to start with (and possibly
    David> undefined, too).

But that's not true.  The match-data was sufficiently predictable that
split-string only failed when it was voided.  I think it's likely that
that mistake has been made elsewhere.

On the other hand, pretty much any time any Lisp code intervenes
between the return of the matching function and entry to the match
data access there is an opportunity for a hook or handler to be
called.  Probability of hitting it on any given path is low, but
potential for random annoyance for years to come is high, I fear.


-- 
Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.




reply via email to

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