guix-devel
[Top][All Lists]
Advanced

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

Re: search-input-file vs (assoc-ref inputs)


From: Ludovic Courtès
Subject: Re: search-input-file vs (assoc-ref inputs)
Date: Mon, 03 Jan 2022 16:29:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi!

Leo Famulari <leo@famulari.name> skribis:

> I noticed that, as part of the transition to the new inputs style [0],
> we are sometimes replacing code like (assoc-ref inputs "foo") with
> (search-input-file inputs "/bin/foo").
>
> I think that we should instead replace the old style with gexps that
> specify which package, in order to keep the equivalent functionality.
>
> Otherwise, we risk regressions, when the code finds a match for the
> desired filename in the wrong input.
>
> I would say that (search-input-file) is a replacement for the Guile
> (which) procedure.
>
> On the other hand, we can replace (assoc-ref inputs ...) with
> (this-package-input "foo").
>
> What do you think?

It depends.  In cases where we want a specific file or directory, I
think we should use ‘which’, ‘search-input-file’, and
‘search-input-directory’.

Sometimes though we want to form strings such as:

  --with-gmp-prefix=/gnu/store/…-gmp-6.3.0

In that case, (this-package-input "gmp") is more appropriate.

However, there are cases where we want code to be independent from the
package name.

For example, we have two implementations of the MPI standard (openmpi
and mpich) which are mostly interchangeable, for instance via
‘--with-input=openmpi=mpich’.  If we hardcode things like
(this-package-input "openmpi") everywhere, then we effectively prevent
input substitution.  The same goes for cases where we have a “-minimal”
variant: the actual name of the package shouldn’t matter.

To summarize, we should rely on package names only when it is strictly
needed.

Thoughts?

Ludo’.



reply via email to

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