From: ludo@gnu.org (Ludovic Courtès)
To: guile-user@gnu.org
Subject: Re: Multiple parallel environments
Date: Thu, 30 Jul 2009 17:45:58 +0200 [thread overview]
Message-ID: <87vdlagond.fsf@gnu.org> (raw)
In-Reply-To: we1mbpn2dwqf.fsf@ssclt003.ee.surrey.ac.uk
Peter Brett <peter@peter-b.co.uk> writes:
> ludo@gnu.org (Ludovic Courtès) writes:
[...]
>> Then you are looking for Guile's nifty first-class modules. The module
>> API is unfortunately lightly documented (info "(guile) Module System
>> Reflection").
>
> Indeed. Should I file a feature request for "more useful
> documentation of the Guile module system"?
You can indeed at this to the bug tracker at
http://savannah.gnu.org/bugs/?group=guile, preferably along with a
patch. :-)
[...]
> How much will the way they work be changing in the next stable series
> of Guile releases?
There should not be any user-visible changes (you can already try out
the 1.9 releases to see by yourself).
> How will they work w.r.t. R6RS modules?
It's unclear whether R6RS module support will be part of the forthcoming
2.0 release series; Julian Graham is working on it, though.
>> What you would do is create one module for each file/project/directory:
>>
>> (define (make-per-file-module name)
>> (let ((m (make-module)))
>> (set-module-name! m name) ;; give the module an optional name
>> (beautify-user-module! m) ;; populate the module with the
>> ;; default bindings
>> m))
>
> Something like the following?
>
> SCM
> create_module_for_dir (char *c_path) /* Path is a UTF-8 string */
> {
> SCM magic = scm_from_locale_symbol ("*magic-dir-module*");
> SCM path = scm_from_locale_symbol (c_path);
> SCM module = scm_resolve_module (scm_list_2 (magic, path));
> scm_remember_upto_here_2 (magic, path);
> return module;
> }
>
> Not entirely sure how to emulate "beautify-user-module!" in C... any ideas?
`resolve-module' returns a new empty module (as with `make-module') if
no module of that name exist, so you really need the effect of
`beautify-user-module!'.
The best way is to invoke it:
SCM beautify = scm_c_lookup ("beautify-user-module!");
scm_call_1 (beautify, module);
Thanks,
Ludo'.
prev parent reply other threads:[~2009-07-30 15:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-29 17:34 Multiple parallel environments Peter Brett
2009-07-30 13:14 ` Ludovic Courtès
2009-07-30 14:12 ` Peter Brett
2009-07-30 14:45 ` Ludovic Courtès
2009-07-30 15:19 ` Peter Brett
2009-07-30 15:45 ` Ludovic Courtès [this message]
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://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vdlagond.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guile-user@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.
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).