all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Ricardo Wurmus <rekado@elephly.net>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Making substitute* throw an error if substition failed?
Date: Mon, 17 Oct 2016 10:50:36 +0200	[thread overview]
Message-ID: <874m4bfjfn.fsf@gnu.org> (raw)
In-Reply-To: <87twceh9h7.fsf@elephly.net> (Ricardo Wurmus's message of "Sat, 15 Oct 2016 00:05:56 +0200")

Hi,

Ricardo Wurmus <rekado@elephly.net> skribis:

> it happened a couple of times already that a “substitute*” expression
> silently failed and I only found out about it when investigating the
> remains of a failing build (“guix build -K”).  This can easily happen
> when a package is updated and substitutions “anchors” no longer exist in
> the updated source code.
>
> Would it be desirable to change “substitute*” (or replace it) such that
> it throws an error or returns a value if substitution failed?

“Failed” as in “there were no pattern matches”, right?

> This might be helpful for the more complex packages with many
> substitutions.  If we make it return a value (#f for error) it would
> also make our build phases a little prettier, I think.  (Now we
> forcefully return #t in any case and that seems wrong.)

I like this idea.  Like others wrote, it could return #t if one or more
substitutions were made, and #f otherwise.

I think it’s better than throwing an error, because there are cases
where it doesn’t matter whether a substitution was made or not (e.g.,
when replacing strings en masse on a set of files.)

WDYT?

Thanks,
Ludo’.

  parent reply	other threads:[~2016-10-17  8:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-14 22:05 Making substitute* throw an error if substition failed? Ricardo Wurmus
2016-10-15  7:53 ` Hartmut Goebel
2016-10-15  8:06 ` Danny Milosavljevic
2016-10-15 17:07 ` Alex Kost
2016-10-17  8:50 ` Ludovic Courtès [this message]
2016-10-17 21:08   ` Efraim Flashner
2016-10-18 12:41     ` 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=874m4bfjfn.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=rekado@elephly.net \
    /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.