Subject: [bug#30657] Add support for file-like objects to the Prosody configuration

From: [email-masked] (Ludovic Courtès)
Date: Fri, 02 Mar 2018 18:00:58 +0100

Hello,

Clément Lassieur <[email-masked]> skribis:

> These patches add support for file-like objects to the Prosody service
> configuration.  The idea is to replace this mechanism (which is used
> very often):
>
>     (plain-file
>       (with-output-to-string
>          ...
>          (format #t ...)
>          ...))
>
> with this one:
>
>     (mixed-text-file
>       (flatten
>         (with-tokens-to-list
>            ...
>            (push-tokens ...)
>            ...))
>
> The point is that tokens don't have to be strings.

That’s a great improvement.

I’m wondering if we could somehow avoid building the token list in this
imperative manner.

We could arrange to procedure a string-value gexp, i.e.:

  #~(string-append #$a #$b #$c)

What if each ‘serialize-*’ procedure produce a string-valued gexp that
can be directly spliced in this big #~(string-append …)?

That would require changing ‘serialize-*’ to return a value (currently
their return value is ignored.)  WDYT?  Doable?  Pointless?

Thanks,
Ludo’.