Hi Michele,

On Sat, Mar 1, 2014 at 7:32 AM, Michele La Monaca <
mikele.chic...@lamonaca.net> wrote:

> Hi,
>
> I've noticed that irregex-replace returns the original string
> if no replacement takes place. I think its a very poor choice.
>
> Whether or not a replacement was actually made can be an important
> piece of information which is lost returning the original string.
> The "correct" return value should be #f.
>
> Ditto irregex-replace/all.
>

I've used irregex-replace{,/all} and equivalents in other
languages for a long time, and find the current semantics
most convenient.  I can see in some cases wanting to test
for a replacement, or in irregex-replace-all the number of
replacements, but it seems to be by far the rarer case
(varying with individual programming style).

Your options right now in these cases are to test for the
match then apply the subst manually, or write a utility to
do so.

If you're interested, there's also SRFI 115 currently under
discussion for standard Scheme regular expressions.

-- 
Alex
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to