Ludovic Courtès <[email protected]> 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
