GNU bug report logs - #36772
feature request: checked variant of "substitute*"

Previous Next

Package: guix;

Reported by: Robert Vollmert <rob <at> vllmrt.net>

Date: Tue, 23 Jul 2019 12:51:01 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Robert Vollmert <rob <at> vllmrt.net>
Cc: 36772 <at> debbugs.gnu.org
Subject: bug#36772: feature request: checked variant of "substitute*"
Date: Tue, 23 Jul 2019 15:35:19 +0200
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





This bug report was last modified 5 years and 323 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.