[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define
From: |
Bruno Victal |
Subject: |
[bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration |
Date: |
Sat, 7 Oct 2023 15:21:48 +0100 |
User-agent: |
Mozilla Thunderbird |
On 2023-10-02 19:28, Maxim Cournoyer wrote:
>> +An example of a simple serializer procedure:
>> +@lisp
>> +(define (serialize-boolean field-name value)
>> + (let ((value (if value "true" "false")))
>> + #~(string-append '#$field-name #$value)))
>> +@end lisp
>> +
>
> I know this is adapted from old code, but shouldn't there be a "=" in
> that string-append, between the field name and its value? […]
I think there's no particular meaning for that isolated snippet but I
believe the original author did intend for there to be a "=" symbol as
you have pointed out. I've went ahead and added the “ = ” (with spaces)
variant instead.
> […] Also, using gexps here seems unnecessary and may confuse the reader.
I don't think so because in general you're going to call
`serialize-configuration' which returns a G-Expression so it's more or
less given that using G-Expressions is perfectly valid and using them
from the outset allows your fields to serialize any kind of value such as
package objects (for something like `gcc-path = /gnu/store/…'), etc.
Thus, not using G-Exps is more restrictive in terms of what you can
serialize. It might not make a difference in some cases but I think
this is a potential source of trouble when someone tries to serialize
a gexp object with a non-gexp ready serializer. (e.g. performing
string-append with a string and a package object)
I'm aware of some cases where this is not a problem such as the case
where you write your own version of `serialize-configuration' to
handle the serialization in some other manner. (perhaps using `list'
instead of `string-append' for the final step)
Such a case is clearly in the “advanced guix hacker” arena and thus
I don't think there's a risk for confusion here.
--
Furthermore, I consider that nonfree software must be eradicated.
Cheers,
Bruno.
- [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration, Maxim Cournoyer, 2023/10/02
- [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration, Maxim Cournoyer, 2023/10/02
- [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration, Maxim Cournoyer, 2023/10/02
- [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration, Maxim Cournoyer, 2023/10/02
- [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration,
Bruno Victal <=
- [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration, Maxim Cournoyer, 2023/10/02
- [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration, Maxim Cournoyer, 2023/10/02