From: Ricardo Wurmus <rekado@elephly.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: use-modules in gexps
Date: Wed, 05 Feb 2020 16:18:12 +0100 [thread overview]
Message-ID: <87d0atqczv.fsf@elephly.net> (raw)
In-Reply-To: <87tv45nmkk.fsf@gnu.org>
Ludovic Courtès <ludo@gnu.org> writes:
>> I wondered if perhaps we could add a G-expression compiler for module
>> imports, so that instead of
>>
>> (with-imported-modules (source-module-closure '((my module)))
>> #~(begin
>> (use-modules (my module))
>> …))
>>
>> we would do
>>
>> #~(begin
>> #$(use-modules (my module))
>> …)
>>
>> which would have the effect of adding (my module) — or the module
>> closure – to the list of modules needed by the current G-expression.
>
> I think the syntax should be different because #$/ungexp has a different
> meaning. However, that would leave open the question of how to select
> the subset of the module’s closure you want to import, etc.
>
>> Can a G-expression compiler help accumulate state (e.g. by making
>> G-expressions values in the state monad) or can it only be compiled down
>> to a value at the current location?
>
> The latter. What state would you want to accumulate?
When I wrote “state” I had the list of modules encountered in mind, so
that it would be possible to collect all marked instances of
“use-module” and hoist them to the top, in effect doing automatically
what is achieved manually by using “with-imported-modules” with a list
of modules.
--
Ricardo
next prev parent reply other threads:[~2020-02-05 15:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-02 20:27 use-modules in gexps Ricardo Wurmus
2020-02-05 14:19 ` Ludovic Courtès
2020-02-05 15:18 ` Ricardo Wurmus [this message]
2020-02-07 21:31 ` Ludovic Courtès
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d0atqczv.fsf@elephly.net \
--to=rekado@elephly.net \
--cc=guix-devel@gnu.org \
--cc=ludo@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.