guix-devel
[Top][All Lists]
Advanced

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

Re: Making substitute* throw an error if substition failed?


From: Efraim Flashner
Subject: Re: Making substitute* throw an error if substition failed?
Date: Tue, 18 Oct 2016 00:08:36 +0300
User-agent: Mutt/1.7.0 (2016-08-17)

On Mon, Oct 17, 2016 at 10:50:36AM +0200, Ludovic Courtès wrote:
> Hi,
> 
> Ricardo Wurmus <address@hidden> 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?
> 

Or as in "your regex was bad, try again"

> > 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’.
> 

I would go with '#t if one or more subsitutions were made, regardless of
the number of files specified' rather than '#t if 1+ substitutions on
every (all) file listed'.


-- 
Efraim Flashner   <address@hidden>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

Attachment: signature.asc
Description: PGP signature


reply via email to

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