From: Marius Vollmer <mvo@zagadka.ping.de>
Cc: guile-devel@gnu.org, jantien@xs4all.nl
Subject: Re: Modules: first steps.
Date: 18 Sep 2002 22:41:31 +0200 [thread overview]
Message-ID: <87ofavghdw.fsf@zagadka.ping.de> (raw)
In-Reply-To: <15749.6859.670744.98083@blauw.xs4all.nl>
Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:
> * Why set-current-module ? I'd expect set-current-module!
I can't really say. I myself have grown a bit tired of the
bang-suffix, I have to say.
> * How can I get a list of all the variables in a module (ok, I can
> figure that out by myself, but why is there no API entry for this?)
The module system hasn't completely arrived yet. (And it is moving
very slowly.) Most of the things that aren't there have simply not
yet been done. A lot of stuff is there, but has not been documented
yet since we are not sure if we want to keep it that way it is
currently done.
That being said, we should definitely proceed in small steps. The big
module system overhaul is not going to happen, as far as I can see.
That being said, there is 'module-for-each' and 'module-map'. We
should probably just document them and make them official.
> * It would be nice if the C smob example also touched on module use.
There is "examples/box-module". Is that what you are looking for, or
something else?
> * I have in my code:
Here is something similar that does work for me:
#include <libguile.h>
void
ly_init_lily_module (void *unused)
{
#if 0
for (int i=scm_init_funcs_->size () ; i--;)
(scm_init_funcs_->elem (i)) ();
if (verbose_global_b)
progress_indication ("\n");
#endif
scm_primitive_load_path (scm_makfrom0str ("lily.scm"));
}
void
ly_init_guile ()
{
scm_c_define_module ("lily", ly_init_lily_module, NULL);
}
int
main (int argc, char **argv)
{
scm_init_guile ();
ly_init_guile ();
}
The reason that you version didn't work is that when
scm_c_resolve_module (and 'resolve-module') can't find the requested
module, it returns a fresh, empty one. It is _totally_ empty, which
means that things like 'use-modules' aren't available. Since you want
to define a new module, you should use scm_c_define_module. It will
do all the right things.
> * extern void scm_c_use_module (const char *name);.
>
> Why is there no scm_use_module (SCM)? For anonymous modules, the
> storing the name just to use it with scm_c_use_module seems silly,
> in particular if that function has to recover the SCM module
> object from the name again.
Agreed. We should have that as well.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2002-09-18 20:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-15 23:42 Modules: first steps Han-Wen Nienhuys
2002-09-18 20:41 ` Marius Vollmer [this message]
2002-09-18 21:11 ` Tom Lord
2002-09-19 0:18 ` Han-Wen Nienhuys
2002-09-21 21:02 ` Marius Vollmer
2002-09-19 20:31 ` Han-Wen Nienhuys
2002-09-19 20:33 ` Rob Browning
2002-09-20 14:21 ` Martin Grabmueller
2002-09-20 22:40 ` Han-Wen Nienhuys
2002-09-19 20:38 ` Han-Wen Nienhuys
2002-09-21 21:07 ` Marius Vollmer
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=87ofavghdw.fsf@zagadka.ping.de \
--to=mvo@zagadka.ping.de \
--cc=guile-devel@gnu.org \
--cc=jantien@xs4all.nl \
/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).