diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2026-03-06 18:46:35 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-03-20 13:27:15 +0100 |
| commit | a7c8e68dc51144a6d3981b770aca9c4897fc7c0c (patch) | |
| tree | 9e1f59985c9d536e71a71860cdf892c2a497d17c /doc | |
| parent | e1457c467953b871d14214f6d617fdfea8ab15c1 (diff) | |
records: Let thunked fields refer to their inherited value.
* guix/records.scm (make-syntactic-constructor)[field-index]: New procedure.
[wrap-field-value]: Add optional argument ‘parent’. When it is true, bind F
to the inherited field value.
[field-bindings/inheritance]: New procedure.
Use it.
* tests/records.scm ("define-record-type* & thunked & no inherited value")
("define-record-type* & thunked & inherited value")
("define-record-type* & thunked & inherited value & this-record"): New tests.
* doc/guix.texi (Defining Package Variants): Update ‘modify-inputs’ example to
refer to ‘inputs’.
(Writing Manifests): Likewise.
* doc/guix-cookbook.texi (Package Variants): Likewise for
‘substitute-keyword-arguments’.
Fixes: https://issues.guix.gnu.org/50335
Change-Id: If4e18155ce203637ff9e116ee8098f8997bfebe2
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/guix-cookbook.texi | 2 | ||||
| -rw-r--r-- | doc/guix.texi | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index 4b6f0ca22c0..83bce66c175 100644 --- a/doc/guix-cookbook.texi +++ b/doc/guix-cookbook.texi | |||
| @@ -5297,7 +5297,7 @@ did above with transformation options. We can add them like so: | |||
| 5297 | "Return P with FLAGS as additional 'configure' flags." | 5297 | "Return P with FLAGS as additional 'configure' flags." |
| 5298 | (package/inherit p | 5298 | (package/inherit p |
| 5299 | (arguments | 5299 | (arguments |
| 5300 | (substitute-keyword-arguments (package-arguments p) | 5300 | (substitute-keyword-arguments arguments |
| 5301 | ((#:configure-flags original-flags #~(list)) | 5301 | ((#:configure-flags original-flags #~(list)) |
| 5302 | #~(append #$original-flags #$flags)))))) | 5302 | #~(append #$original-flags #$flags)))))) |
| 5303 | 5303 | ||
diff --git a/doc/guix.texi b/doc/guix.texi index e7bcd174a8e..d5f782f35c4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -8800,14 +8800,15 @@ dependency like so: | |||
| 8800 | (define gdb-sans-guile | 8800 | (define gdb-sans-guile |
| 8801 | (package | 8801 | (package |
| 8802 | (inherit gdb) | 8802 | (inherit gdb) |
| 8803 | (inputs (modify-inputs (package-inputs gdb) | 8803 | (inputs (modify-inputs inputs |
| 8804 | (delete "guile"))))) | 8804 | (delete "guile"))))) |
| 8805 | @end lisp | 8805 | @end lisp |
| 8806 | 8806 | ||
| 8807 | The @code{modify-inputs} form above removes the @code{"guile"} package | 8807 | In the body of the @code{inputs} field above, @code{inputs} is bound to |
| 8808 | from the @code{inputs} field of @code{gdb}. The @code{modify-inputs} | 8808 | the inherited value. Thus, the @code{modify-inputs} form above removes |
| 8809 | macro is a helper that can prove useful anytime you want to remove, add, | 8809 | the @code{"guile"} package from the @code{inputs} field of @code{gdb}. |
| 8810 | or replace package inputs. | 8810 | The @code{modify-inputs} macro is a helper that can prove useful anytime |
| 8811 | you want to remove, add, or replace package inputs. | ||
| 8811 | 8812 | ||
| 8812 | @defmac modify-inputs inputs clauses | 8813 | @defmac modify-inputs inputs clauses |
| 8813 | Modify the given package inputs, as returned by @code{package-inputs} & co., | 8814 | Modify the given package inputs, as returned by @code{package-inputs} & co., |
| @@ -9131,7 +9132,7 @@ these lines: | |||
| 9131 | (define gdb-sans-guile | 9132 | (define gdb-sans-guile |
| 9132 | (package | 9133 | (package |
| 9133 | (inherit gdb) | 9134 | (inherit gdb) |
| 9134 | (inputs (modify-inputs (package-inputs gdb) | 9135 | (inputs (modify-inputs inputs |
| 9135 | (delete "guile"))))) | 9136 | (delete "guile"))))) |
| 9136 | 9137 | ||
| 9137 | ;; Return a manifest containing that one package plus Git. | 9138 | ;; Return a manifest containing that one package plus Git. |
