'subst' argument is described like this:
> subst can be a string, an integer or symbol indicating the contents of a numbered or named submatch of re, 'pre for the substring to the left of the match, or 'post for the substring to the right of the match.
what's missing is, 'subst' can also be a list of these symbols,
numbers or strings. I thought regexp-replace was very limited (if it
only supported either int, sym or str), but this makes it much better.
Chibi test suite does test this case.
I believe this was an oversight. Irregex, (chibi regexp), and SCSH all support lists for subst.
However, as it's not broken but just less useful I don't think it's suitable for an errata.
Corner case: does 'subst' accept nested lists?
I can't think of an argument for why it should, and it conflicts with various useful extensions.
The user also cannot name capture groups 'pre' and 'post' if they want
to use them to replace. But I guess that ship has sailed.
An unforeseen interaction between the regexp substitution from the original SCSH and support for named submatches common in modern regex libraries.
Note another Chibi extension is a procedure which takes the match object as an argument.
This could be used to fetch 'pre or 'post variables.
Another workaround could be allowing (submatch <name>) for an explicit submatch reference.
Note passing a list (or procedure) "is an error" so implementations are allowed to provide these extensions.
--
Alex