bug-guix
[Top][All Lists]
Advanced

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

bug#36772: feature request: checked variant of "substitute*"


From: Ricardo Wurmus
Subject: bug#36772: feature request: checked variant of "substitute*"
Date: Tue, 23 Jul 2019 15:35:19 +0200
User-agent: mu4e 1.2.0; emacs 26.2

Hi Robert,

> I think it would be great to have the following variant of substitute*:
>
> (substitute*-once filename (pattern vars) body)
>
> which acts like the usual substitute-*, except it also asserts that the
> substitution applies to exactly one line in the file, causing a build
> failure otherwise.

I agree that the effect of substitute* should be checked.  I think
substitute* should fail when one of its clauses failed to match
anything.

Each clause could also accept an optional argument to make them only
match one location.  We wouldn’t have to duplicate the macro for that
and it’s a simple extension to failing on zero matches.

What do you think?

--
Ricardo






reply via email to

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