GNU bug report logs -
#53663
[PATCH] gnu: services: Also accept 'undefined in maybe-foo? constructs.
Previous Next
Reported by: Attila Lendvai <attila <at> lendvai.name>
Date: Mon, 31 Jan 2022 15:35:01 UTC
Severity: normal
Tags: patch
Done: Attila Lendvai <attila <at> lendvai.name>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hi!
Attila Lendvai <attila <at> 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’.
This bug report was last modified 3 years and 170 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.