Tomas Volf <[email protected]> skribis:
> Incidentally, I completely forgot that this-packages is a thing (I never
> managed to use it correctly, I usually end up in infinite loops). But
> that gives me an idea. What about:
>
> (let ((services (modify-services ...)))
> (operating-system
> (inherit %base-os)
> (services this-operating-system-services)))
>
> (package
> (inherit foo)
> (inputs (modify-inputs this-package-inputs ...)))
>
> ?
And where would the identifier ‘this-package-inputs’ come from?
There’s an important property of macros referred to as “hygiene” (a
proper name would be “referential transparency”). One aspect of it is
that any binding that is introduced must appear in the source. For
example, ‘this-package’ appears as an argument to ‘define-record-type*’.
Hence my question.
(There’s a way to break this hygiene rule (‘define-configuration’ does
that), but it’s fraught with peril.)
Besides, one might be tempted to think that:
this-package-inputs = (package-inputs this-package)
… which would not be the case.
Ludo’.
PS: Instead of introducing a new binding, my initial implementation used
a global syntax parameter, ‘inherited-value’, which would only be
valid within the body of an inherited thunked field. Good thing: no
shadowing. Bad thing: every user of a record type would have to
import (guix records) to access ‘inherited-value’—a showstopper.