[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add a way to disable serialization support to (guix services configu
From: |
Xinglu Chen |
Subject: |
Re: Add a way to disable serialization support to (guix services configuration) |
Date: |
Fri, 23 Apr 2021 08:09:55 +0200 |
Hi,
On Fri, Apr 23 2021, Ludovic Courtès wrote:
> Hi,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>>> +(define-syntax-rule (without-field-serialization definition)
>>> + (syntax-parameterize ((configuration-field-serialization?
>>> + (identifier-syntax #f)))
>>> + definition
>>> + #t))
>>> +
>>> +(without-field-serialization
>>> + (define-configuration foo
>>> + (bar (integer 123) "doc")))
>
> In hindsight, I find this syntax quite inelegant and suboptimal.
>
> Wouldn’t it be nicer to write:
>
> (define-configuration foo
> (bar (integer 123) "doc" no-serializer)
> (baz (string "") "doc"))
>
> where ‘bar’ wouldn’t have a serializer and ‘baz’ would?
>
> It’s also probably easier to implement correctly.
I think that would be a good idea, maybe it could also make having a
default value be optional, like this:
#+begin_src scheme
(define-configuration foo
(bar (integer) "doc" no-serializer) ;no default
(baz (string "default") "doc"))
#+end_src
Maxim and I had a discussion about this[1].
[1]: 87k0ov7w72.fsf@yoctocell.xyz">https://yhetil.org/guix-devel/87k0ov7w72.fsf@yoctocell.xyz