From: "Ludovic Courtès" <ludo@gnu.org>
To: Andrew Tropin <andrew@trop.in>
Cc: guix-devel <guix-devel@gnu.org>, Xinglu Chen <public@yoctocell.xyz>
Subject: Re: Early feedback on Guix Home
Date: Sat, 10 Jul 2021 16:18:11 +0200 [thread overview]
Message-ID: <87pmvqckws.fsf@gnu.org> (raw)
In-Reply-To: <87a6n751cg.fsf@trop.in> (Andrew Tropin's message of "Wed, 30 Jun 2021 09:10:55 +0300")
Hi,
(Sorry for the late reply…)
Andrew Tropin <andrew@trop.in> skribis:
> Ludovic Courtès <ludo@gnu.org> writes:
[...]
>>>> Possible action:
>>>>
>>>> 1. Change config records to accept file-like objects instead of
>>>> strings. That way, users can choose to have snippets inlined (in a
>>>> ‘plain-file’ object) or separate (via ‘local-file’). See for
>>>> example how ‘tor-configuration->torrc’ does it.
>>>
>>> Yeah, there is a ‘slurp-file-gexp’ procedure that let’s one read an
>>> extenal file, but using existing APIs like ‘local-file’ is probably a
>>> better idea.
>>
>> Yes, it feels more natural. Also, ‘slurp-file-gexp’ returns a gexp (a
>> code snippet), but as a user you don’t know where that snippet is going
>> to be inserted; it may not work in some contexts.
>
> Acually, the idea behind `slurp-file-gexp` is that you always know where
> it will be inserted, because it will be inside the specific section of
> the configuration. Take a look at emacs home-service example:
> https://git.sr.ht/~abcdw/rde/tree/master/item/gnu/home-services/emacs.scm#L91
What I mean is that, in a general sense, one cannot know whether the
gexp will be inserted in a place where it’s “valid”. Consider the
following examples, where the gexp is meant to be inserted in lieu of
“PLACEHOLDER”:
#~(list '(#$PLACEHOLDER)) ;it’s quoted
#~(let ((call-with-input-file (const #f)))
#$PLACEHOLDER)
These are “hygiene” problems discussed in the “Code Staging in GNU Guix”
paper.
All this to say that, from an API viewpoint, I think it’s (1) more
robust, as I wrote, and (2) clearer to expect file-like objects in such
places. It’s clearer because users can be expected to have an
understanding of what ‘local-file’ does, whereas ‘slurp-file-gexp’ is
more involved.
I hope this clarifies what I had in mind!
Ludo’.
next prev parent reply other threads:[~2021-07-10 14:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-23 13:15 Early feedback on Guix Home Ludovic Courtès
2021-06-24 5:40 ` Andrew Tropin
2021-06-29 10:25 ` Ludovic Courtès
2021-06-24 8:14 ` Xinglu Chen
2021-06-24 15:18 ` Andrew Tropin
2021-06-29 10:33 ` Ludovic Courtès
2021-06-30 6:10 ` Andrew Tropin
2021-07-10 14:18 ` Ludovic Courtès [this message]
2021-07-20 11:01 ` Andrew Tropin
2021-07-04 13:21 ` Xinglu Chen
2021-06-24 16:50 ` jbranso
2021-06-24 17:42 ` Andrew Tropin
2021-06-24 18:42 ` Leo Prikler
2021-06-25 7:03 ` Andrew Tropin
2021-06-25 4:13 ` Joshua Branson
2021-06-25 7:17 ` Andrew Tropin
2021-06-25 18:08 ` Early feedback on Guix Home and a basic almost complete sway service Joshua Branson
2021-06-30 6:03 ` Andrew Tropin
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pmvqckws.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=andrew@trop.in \
--cc=guix-devel@gnu.org \
--cc=public@yoctocell.xyz \
/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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).