bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44612: Read standard input in `guix repl'


From: Ludovic Courtès
Subject: bug#44612: Read standard input in `guix repl'
Date: Mon, 16 Nov 2020 13:52:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi,

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Hi,
>>
>> Bengt Richter <bokr@bokr.com> skribis:
>>
>>> On +2020-11-13 10:41:38 +0100, Pierre Neidhardt wrote:
>>>> `guix repl` is a fantastic, hassle-free tool to bind Guix with
>>>> third-party languages.  I've done it here:
>>>> 
>>>> https://github.com/atlas-engineer/nyxt/blob/2-pre-release-4/libraries/ospama/ospama-guix.lisp
>>
>> I recommend using ‘guix repl -t machine’
>
> Looks like `-t machine` has the same issue.
> This does what I want:
>
> $ echo "(display \"Hi.\\n\")" | guix repl -t machine /dev/stdin
> Hi.
>
>
> This does not:
>
> $ echo "(display \"Hi.\\n\")" | guix repl -t machine  
> (repl-version 0 1 1)
> Hi.
> (values (non-self-quoting 2052 "#<unspecified>"))

The general idea is that the REPL protocol allows you to offload
computations to the ‘guix repl’ process and to read the result of those
computations.  Side effects such as writing to stdout are not treated,
but they’re mostly beyond the scope of ‘guix repl’.

>> and keeping the REPL process around instead of respawning it for every
>> expression.
>
> At first glance, we would want to do this indeed.
>
> But in the case of Nyxt, there would be no point when to terminate the
> process, so it would be around for the whole time Nyxt is running, which
> may not be desirable.

I think it’s desirable since it saves on CPU costs.

> Alternatively, I could simply keep it alive for a given duration (1
> minute?) and automatically spawn it if the process is dead.

Yes, that’s a reasonable tradeoff.

Thanks,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]