From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.devel Subject: Re: Modules: first steps. Date: 18 Sep 2002 22:41:31 +0200 Sender: guile-devel-admin@gnu.org Message-ID: <87ofavghdw.fsf@zagadka.ping.de> References: <15749.6859.670744.98083@blauw.xs4all.nl> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1032381724 7107 127.0.0.1 (18 Sep 2002 20:42:04 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 18 Sep 2002 20:42:04 +0000 (UTC) Cc: guile-devel@gnu.org, jantien@xs4all.nl Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17rle7-0001qT-00 for ; Wed, 18 Sep 2002 22:42:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17rleO-0007my-00; Wed, 18 Sep 2002 16:42:20 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17rldY-0007em-00 for guile-devel@gnu.org; Wed, 18 Sep 2002 16:41:28 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17rldV-0007aC-00 for guile-devel@gnu.org; Wed, 18 Sep 2002 16:41:27 -0400 Original-Received: from dialin.speedway42.dip151.dokom.de ([195.138.42.151] helo=zagadka.ping.de) by monty-python.gnu.org with smtp (Exim 4.10) id 17rldU-0007Zj-00 for guile-devel@gnu.org; Wed, 18 Sep 2002 16:41:24 -0400 Original-Received: (qmail 8424 invoked by uid 1000); 18 Sep 2002 20:41:31 -0000 Original-To: hanwen@cs.uu.nl In-Reply-To: <15749.6859.670744.98083@blauw.xs4all.nl> Original-Lines: 79 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:1353 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1353 Han-Wen Nienhuys 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 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