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

Effect of string mutation on submatch extraction

This page is part of the web mail archives of SRFI 115 from before July 7th, 2015. The new archives for SRFI 115 contain all messages, not just those from before July 7th, 2015.



Hi,

After removing the string arguments from the submatch extraction
procedures, should the results of things like the following be
specified?

    (define s "abc")
    (define m (regexp-search "b" s))
    (regexp-match-submatch m 0) ; => "b"
    (string-set! s 1 #\B)
    (regexp-match-submatch m 0) ; => "b", "B", or undefined?

Chibi returns "B", which I also think is the better option since it's
simpler and probably more efficient, though "b" is arguably nicer for
the user. Either way, is it worth specifying one (even if that's just
"undefined")?

Evan