1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 13:10:33 +02:00

gexp: Add 'delayed-object'.

* guix/gexp.scm (<delayed-object>): New record type.
(delayed-object): New macro.
(delayed-object-compiler): New gexp compiler.
* tests/gexp.scm ("delayed-object"): New test.
* doc/guix.texi (G-Expressions): Document it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
David Elsing
2026-02-03 21:33:21 +01:00
committed by Ludovic Courtès
parent 7d1b86859b
commit 96bd726277
3 changed files with 45 additions and 0 deletions

View File

@@ -148,6 +148,7 @@ Copyright @copyright{} 2025 Edouard Klein@*
Copyright @copyright{} 2025 Rodion Goritskov@*
Copyright @copyright{} 2025 dan@*
Copyright @copyright{} 2025 Noé Lopez@*
Copyright @copyright{} 2026 David Elsing@*
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -12982,6 +12983,15 @@ The example above returns an object that corresponds to the i686 build
of Coreutils, regardless of the current value of @code{%current-system}.
@end defmac
@defmac delayed object exp
This macro delays the evaluation of @var{exp} until the returned object
is lowered to a derivation or store item.
Its intended use case is to prevent the use of a non-delayed top-level
variable of another module, e.g. when using a gexp in the @code{source}
field of a @var{package}.
@end defmac
@anchor{gexp-input}
@deffn {Procedure} gexp-input @var{obj} [@var{output}] [#:native? #f]
Return a @dfn{gexp input} record for the given @var{output} of file-like