[Top][All Lists]

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

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

From: Robert Vollmert
Subject: bug#36772: feature request: checked variant of "substitute*"
Date: Tue, 23 Jul 2019 14:49:46 +0200

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.

In the cases where this is sufficient (I believe most), it would make
substitution work quite a bit more reliably, making it both easier to
debug substitution when first packaging, and noticing more easily when
they need to be adapted on upgrades.

(It would be possible to make the signature a bit more flexible and to
allow multiple files or patterns as in substitute*, but that would
make the meaning of “applies exactly once” a bit unclear, so I’d prefer
to not do that. Similarly, I find it cleaner to potentially call
substitute*-once several times in a row with different substitutions to
make the ordering of effects explicit.)

(I’d be happy to supply a patch myself eventually, but the syntax rule
business is a bit out of reach at this point.)

reply via email to

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