unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: "Andrew Tropin" <andrew@trop.in>,
	guix-devel@gnu.org, "Oleg Pykhalov" <go.wigust@gmail.com>,
	"Ludovic Courtès" <ludo@gnu.org>
Cc: Xinglu Chen <public@yoctocell.xyz>, guix-maintainers@gnu.org
Subject: Re: Return back original implementation for text-config serialization
Date: Sun, 09 Jan 2022 20:00:40 +0100	[thread overview]
Message-ID: <c0d20054711dcb952f5375c923dc784e41b8244a.camel@telenet.be> (raw)
In-Reply-To: <87y23o3i3p.fsf@trop.in>

[-- Attachment #1: Type: text/plain, Size: 1536 bytes --]

Andrew Tropin schreef op zo 09-01-2022 om 20:59 [+0300]:
> [...]
> I think we can just rely on something like that:
> --8<---------------cut here---------------start------------->8---
> #~(call-with-input-file #$(local-file "./files/bashrc")
>     (@ (ice-9 textual-ports) get-string-all))
> --8<---------------cut here---------------end--------------->8---
> 
> As I mentioned in reply to Liliana, from my experience it's a rare case,
> when we really need to slurp the content of the file, in most cases
> include/source and other similar consturctions can do the trick, so it
> maybe not necessary to have a helper for this case at all.
> 
> WDYT?
> 
> BTW, even after reading "Code Staging in GNU Guix" paper, I still not
> sure what the problem with slurp-file-gexp (except maybe name :) ).

Looking at the reasons at <https://issues.guix.gnu.org/52698>, the
issue seems mostly naming to me.  When I read 'slurp-file-gexp', what I
thought was happening, is that first the file-like object is lowered
and then the G-Exp of the builder is extracted from the derivation.

Maybe name it

(define (file-contents object)
  "Construct a G-expression that reads the file-like object OBJECT
and returns the contents as a string."
  ;; TODO: do we need to set the encoding to UTF-8 here?
  #~((@ (relevant guile module) call-with-input-file)
     #$object
     (@ (ice-9 textual-ports) get-string-all)))

That would avoid having to remember the (call-with-input-file ...)
trick.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  reply	other threads:[~2022-01-09 19:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-09  9:12 Return back original implementation for text-config serialization Andrew Tropin
2022-01-09 11:19 ` Liliana Marie Prikler
2022-01-09 17:48   ` Andrew Tropin
2022-01-09 19:44     ` Liliana Marie Prikler
2022-01-10  9:49       ` Andrew Tropin
2022-01-10 20:12         ` Liliana Marie Prikler
2022-01-12 15:05           ` Andrew Tropin
2022-01-09 12:17 ` Maxime Devos
2022-01-09 12:19 ` Maxime Devos
2022-01-09 17:59   ` Andrew Tropin
2022-01-09 19:00     ` Maxime Devos [this message]
2022-01-18 14:26 ` Ludovic Courtès
2022-01-20 13:20   ` Andrew Tropin
2022-01-21  9:30     ` Maxime Devos
2022-01-26  8:34       ` Andrew Tropin
2022-01-27  5:04         ` Maxim Cournoyer
2022-01-28 15:48           ` Andrew Tropin
2022-02-05 11:09           ` Ludovic Courtès
2022-02-13 14:14             ` Andrew Tropin
2022-01-26  8:36       ` Andrew Tropin
2022-02-05 11:34         ` Maxime Devos
2022-02-13 14:09           ` Andrew Tropin
2022-01-24 15:37     ` Ludovic Courtès
2022-01-26  9:11       ` Andrew Tropin
2022-01-26  9:21         ` Andrew Tropin
2022-02-05 14:43     ` Xinglu Chen

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=c0d20054711dcb952f5375c923dc784e41b8244a.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=andrew@trop.in \
    --cc=go.wigust@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=guix-maintainers@gnu.org \
    --cc=ludo@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).