unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: edk@beaver-labs.com
Cc: help-guix@gnu.org
Subject: Re: I think thunked fields are breaking my previously working code
Date: Mon, 10 Jan 2022 22:39:07 +0100	[thread overview]
Message-ID: <877db78dr0.fsf@elephly.net> (raw)
In-Reply-To: <87y23nfozl.fsf@rdklein.fr>


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	other threads:[~2022-01-10 21:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 17:55 I think thunked fields are breaking my previously working code edk
2022-01-10 21:39 ` Ricardo Wurmus [this message]
2022-02-27 20:35   ` Edouard Klein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877db78dr0.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=edk@beaver-labs.com \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).