On Wed, Oct 16, 2013 at 4:23 AM, Peter Bex <xxxxxx@xs4all.nl> wrote:
Hi all,

After clearing the initial roadblocks, I tried to use the library.
Being used to irregex I naively typed away and got this:

(define m (regexp-match '(seq ($ "x") "y") "xy"))
(rx-match-submatch m 1) => ERROR!

So, I looked up the syntax again and was confused:  why does the
rx-match-submatch procedure require the input string again?

Actually I can't remember why I made this change.

The advantage is that it uses one word less memory
for each match (and while running for each active
state in the search).  It's also nicer on GC if you have
a long-lived match object but don't actually need to
extract any substrings (unlikely).

On the other hand it's less convenient, and can give
weird results if passed the wrong string as you point
out.  It's also a bad design if you want a chunked
string API like in IrRegex.

Unless anyone has any other objections, I'll change the
rx-match-submatch API to omit the string input.

-- 
Alex