unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Attila Lendvai <attila@lendvai.name>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: using an SRFI that is not available in Guile
Date: Mon, 24 Jan 2022 23:02:16 +0000	[thread overview]
Message-ID: <ed7EdLOksTYzEpZPt6OZjqZ7qETpNsBNndlbh33dHScPMuh-JDM-KXzJi64Y0U9mxJ3Ht6dTUdKT8DvIAC5aGZ1Qg3V01qx1rGvv8723kCg=@lendvai.name> (raw)
In-Reply-To: <87ilu9rvit.fsf@gnu.org>

using *unspecified* here won't work, because Guile's underlying record
implementation uses it pretty much for the same purpose: it errors
when it encounters *unspecified* as a field value:

> (cfg)
While compiling expression:
Syntax error:
unknown file:761:0: %cfg: missing field initializers (threads) in form (%cfg)

so, i'm back to square one: short of another idea, i'll need srfi-189
for this.


> I see. The ‘define-configuration’ macro uses 'disabled as a way to
> indicate fields that have not been user-specified. Would that be of any
> help in this context?


as discussed already somewhere, regardless of everything else, using
'DISABLED in this context is a bad idea that warrants a patch in
itself; it's super confusing and error prone because configs are full
of boolean fields.


> Another approach would be to use ‘define-record-type*’ and record all
> the default values, including those derived from other fields (just like
> the default ‘home-directory’ field of <user-account> is derived from
> ‘name’.)
>
> Does that make sense?


i think it does, but it would enforce a rather different code
organization. right now i have a function called APPLY-CONFIG-DEFAULTS
that is called at the beginning of each entry point to my service
code. it makes sure that the input config is valid, and returns a new
config object that has the defaults filled in. it has corss-referenced
local variables and even some local functions.

assuming that the evaluation of the default value forms of thunked
fields is delayed until their first access, then forcing this logic
into multiple default forms is possible, but i'd rather not if i can
avoid it.

also, i do want to have the goodies of DEFINE-CONFIGURATION. i used to
use DEFINE-RECORD* before, prior to knowing that D-C was a thing. then
i rewrote my code to use D-C.

maybe i can smarten up DEFINE-CONFIGURATION to (optionally?) use
thunked fields? i'll need to sleep on it.

Ludovic, you're not too happy about the use of extra dependencies
here, right? if so, can you please advise whether i can proceed with
giving srfi-189 a try and see what it looks like (i.e. it's not off
the table to get it accepted)? or do you have any other ideas?

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
Before you speak, let your words pass through three gates:
  At the first gate, ask yourself ‘Is is true?’
  At the second gate ask, ‘Is it necessary?’
  At the third gate ask, ‘Is it kind?’
	— Sufi saying



  reply	other threads:[~2022-01-24 23:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-12 16:46 using an SRFI that is not available in Guile Attila Lendvai
2022-01-12 17:01 ` Attila Lendvai
2022-01-12 17:09 ` Maxime Devos
2022-01-13  9:55   ` Attila Lendvai
2022-01-13 10:49     ` Maxime Devos
2022-01-13 18:20       ` Attila Lendvai
2022-01-13 20:48         ` Attila Lendvai
2022-01-14 12:02         ` Maxime Devos
2022-01-17 13:45           ` Attila Lendvai
2022-01-13 10:53     ` Maxime Devos
2022-01-13 10:56       ` Maxime Devos
2022-01-18 15:09 ` Ludovic Courtès
2022-01-18 17:06   ` Attila Lendvai
2022-01-19 10:34     ` Ludovic Courtès
2022-01-21 13:59       ` Attila Lendvai
2022-01-24 15:41         ` Ludovic Courtès
2022-01-24 23:02           ` Attila Lendvai [this message]
2022-02-05 11:13             ` Ludovic Courtès

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='ed7EdLOksTYzEpZPt6OZjqZ7qETpNsBNndlbh33dHScPMuh-JDM-KXzJi64Y0U9mxJ3Ht6dTUdKT8DvIAC5aGZ1Qg3V01qx1rGvv8723kCg=@lendvai.name' \
    --to=attila@lendvai.name \
    --cc=guix-devel@gnu.org \
    --cc=ludo@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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).