all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Vollmert <rob@vllmrt.net>
To: 36772@debbugs.gnu.org
Subject: bug#36772: feature request: checked variant of "substitute*"
Date: Tue, 23 Jul 2019 14:49:46 +0200	[thread overview]
Message-ID: <E8613602-3151-405B-AC42-20D0A2CAD299@vllmrt.net> (raw)

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	other threads:[~2019-07-23 12:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23 12:49 Robert Vollmert [this message]
2019-07-23 13:35 ` bug#36772: feature request: checked variant of "substitute*" Ricardo Wurmus
2019-07-23 13:41   ` Robert Vollmert
2019-07-25 17:40   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E8613602-3151-405B-AC42-20D0A2CAD299@vllmrt.net \
    --to=rob@vllmrt.net \
    --cc=36772@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.