[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: I think thunked fields are breaking my previously working code
From: |
Edouard Klein |
Subject: |
Re: I think thunked fields are breaking my previously working code |
Date: |
Sun, 27 Feb 2022 21:35:21 +0100 |
User-agent: |
mu4e 1.6.10; emacs 27.2 |
Thank you so much Ricardo, you have no idea how big of a thorn you
removed from my side. I owe you one.
Ricardo Wurmus <rekado@elephly.net> writes:
> 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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: I think thunked fields are breaking my previously working code,
Edouard Klein <=