help-guix
[Top][All Lists]
Advanced

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

Re: I think thunked fields are breaking my previously working code


From: Ricardo Wurmus
Subject: Re: I think thunked fields are breaking my previously working code
Date: Mon, 10 Jan 2022 22:39:07 +0100
User-agent: mu4e 1.6.10; emacs 27.2

edk@beaver-labs.com writes:

> For example, given that "minimal-container" is an operating system, I
> can do the following:
>
> (set-fields minimal-container ((operating-system-host-name) "toto"))
>
> But not:
>
> (set-fields minimal-container ((operating-system-label) "toto"))

In Guile we usually try to avoid mutation like that.  The records API
allows you to use inheritance instead:

  (operating-system
    (inherit minimal-container)
    (label "toto"))

Thunking just means that the field is a procedure that returns a value
when called with no arguments.  The records in (guix records) are not
plain SRFI9 records, so I would not expect set-fields to work at all.

-- 
Ricardo



reply via email to

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