[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Weird module behaviour
From: |
Barry Schwartz |
Subject: |
Re: Weird module behaviour |
Date: |
Thu, 25 Sep 2014 11:31:34 -0500 |
User-agent: |
Mutt/1.5.22 (2013-10-16) |
Panicz Maciej Godek <address@hidden> skribis:
> I'm trying to use Aleix Conchillo's guile-redis module for my project,
> and it revealed a surprising use-case.
> Namely, guile-redis consists of several modules that are put together
> in one meta-module, which looks more or less like this:
>
> (define-module (redis)
> #:use-module (redis main)
> #:use-module (redis commands connection)
> #:use-module (redis commands hashes)
> #:use-module (redis commands keys)
> ...)
>
> (define-syntax re-export-modules
> (syntax-rules ()
> ((_ (mod ...) ...)
> (begin
> (module-use! (module-public-interface (current-module))
> (resolve-interface '(mod ...)))
> ...))))
>
> (re-export-modules
> (redis main)
> (redis commands connection)
> (redis commands hashes)
> (redis commands keys)
> ...)
>
> So basically the meta-module adds the interfaces of its child modules.
> This isn't particularly surprising, because another way of creating a
> meta-module would be to enumerat all bindings from its child modules,
> which is a lot of work that would create an opportunity for
> desynchronization.
As a side note, FYI I have some stuff called ‘generate-reexporter’ to
help deal with the desync problem, at
https://bitbucket.org/sortsmill/sortsmill-core-guile
I almost always use R⁶RS-style modules but there is some support for
Guilish notation in the stuff that is being re-exported.