all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Attila Lendvai <attila@lendvai.name>
Cc: 53663@debbugs.gnu.org
Subject: [bug#53663] [PATCH] gnu: services: Also accept 'undefined in maybe-foo? constructs.
Date: Tue, 01 Feb 2022 10:53:38 +0100	[thread overview]
Message-ID: <87ilty6hgd.fsf@gnu.org> (raw)
In-Reply-To: <20220131152753.19880-1-attila@lendvai.name> (Attila Lendvai's message of "Mon, 31 Jan 2022 16:27:54 +0100")

Hi!

Attila Lendvai <attila@lendvai.name> skribis:

> This is a temporary bandaid until a more explicit handling of maybe types is
> introduced for configurations (e.g. by using srfi-189). Until then, with this
> change it becomes possible to have definitions like:
>
> (define-maybe string (no-serialization))
>
> (define-configuration my-configuration
>   (my-field (maybe-string))
>   (no-serialization))
>
> i.e. without providing a default value for MY-FIELD.
> ---
>  gnu/services/configuration.scm | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
> index 0de350a4df..c5f276eab5 100644
> --- a/gnu/services/configuration.scm
> +++ b/gnu/services/configuration.scm
> @@ -141,7 +141,9 @@ (define (define-maybe-helper serialize? prefix syn)
>                                      (id #'stem #'serialize-maybe- #'stem))))
>         #`(begin
>             (define (maybe-stem? val)
> -             (or (eq? val 'disabled) (stem? val)))
> +             (or (eq? val 'disabled)
> +                 (eq? val 'undefined)
> +                 (stem? val)))

My understanding is that 'disabled is here precisely to allow users to
not provide a value, in which case the generated configuration file will
not contain anything for that field.

What would be different here?

Thanks,
Ludo’.




  reply	other threads:[~2022-02-01  9:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31 15:27 [bug#53663] [PATCH] gnu: services: Also accept 'undefined in maybe-foo? constructs Attila Lendvai
2022-02-01  9:53 ` Ludovic Courtès [this message]
     [not found]   ` <Go3Xae9pfXgOvYZqOORu5yBtXDUCzhtCzs2XryuL9XDL_MZGi3wYlo9wRcGvm_daPJPmPbx3nEx566pf22YVGJVN9mmBL_Iu8NRwdBQN7Ec=@lendvai.name>
2022-02-02 11:47     ` bug#53663: Fw: Re: bug#53663: " Attila Lendvai

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

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

  git send-email \
    --in-reply-to=87ilty6hgd.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=53663@debbugs.gnu.org \
    --cc=attila@lendvai.name \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.