Hi Noé,

Thanks for volunteering to make this important improvement.  Just
checking, are you aware of past efforts from Jakub in that area?  It
looks like we had something ready in 2023 [0], but it must have fallen in a
crack around a core-updates merge or something.

[0]  https://lists.gnu.org/archive/html/guix-patches/2023-10/msg01256.html

The plan back then was simple:

1. Change substitute* so that if one of its patterns had no match, it
raises a &substitute-error condition.

2. Rebuild the world with it, and fix the many (few?) breakage it
caused, adding '#:require-matches? #f' to the cases where it is actually
wanted/expected that the pattern would not match.

IIUC, this differs from your plan in a the following ways:

a) Does not go through an API deprecation (keeps using substitute*)
b) substitute* would remain a bit looser than your proposed
substitute-file, as when #:require-matches? it's possible that a regexp
would not match, unlike your version.

I think b) could be modified so that it matches with your behavior,
which is nicer (more strict).

About a), I'm ambivalent; your approach is sound and is likely to at
least give us a partial result (substitute-file), while the previous
attempt was more upfront, but with the benefit of not having to go
through a slow transition phase and exposing real bugs earlier.

I'm fine either way, but I think I'd lean toward substitute* if I was to
attempt this myself, as its less disruptive for the source code, and I
don't expect too many problems... I'd also be curious to see how many
problems were actually uncovered.

-- 
Thanks,
Maxim

Reply via email to