From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Volkan YAZICI Newsgroups: gmane.lisp.guile.user Subject: Re: Creating Modules within C Date: Wed, 22 Nov 2006 23:08:22 +0200 Message-ID: <20061122210821.GB1478@alamut> References: <20061116224812.GA1686@alamut> <87psbmnw7q.fsf@laas.fr> <20061120184449.GB1317@alamut> <874psrwf5m.fsf@laas.fr> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1164229812 3874 80.91.229.2 (22 Nov 2006 21:10:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 22 Nov 2006 21:10:12 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Nov 22 22:10:11 2006 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GmzLp-0002E5-Gw for guile-user@m.gmane.org; Wed, 22 Nov 2006 22:09:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GmzLp-0002Sw-0B for guile-user@m.gmane.org; Wed, 22 Nov 2006 16:09:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GmzLa-0002RU-6u for guile-user@gnu.org; Wed, 22 Nov 2006 16:09:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GmzLY-0002QH-3s for guile-user@gnu.org; Wed, 22 Nov 2006 16:09:32 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GmzLX-0002Q3-OV for guile-user@gnu.org; Wed, 22 Nov 2006 16:09:31 -0500 Original-Received: from [212.175.13.129] (helo=fep05.ttnet.net.tr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GmzLW-0004Du-SC for guile-user@gnu.org; Wed, 22 Nov 2006 16:09:31 -0500 Original-Received: from (unknown [192.168.8.105]) by AVGW-I-6.ttnet.net.tr with smtp id 584e_bd7ae612_7a6d_11db_9d05_0011433771ac; Wed, 22 Nov 2006 23:09:30 +0200 Original-Received: from alamut ([81.213.83.66]) by fep05.ttnet.net.tr with ESMTP id <20061122210927.GLAT10864.fep05.ttnet.net.tr@alamut>; Wed, 22 Nov 2006 23:09:27 +0200 Original-Received: from (dsl.dynamic812138366.ttnet.net.tr [81.213.83.66]) by AVGW-I-3.ttnet.net.tr with smtp id 0b8a_bcd18a40_7a6d_11db_8679_001422175f4f; Wed, 22 Nov 2006 23:09:27 +0200 Original-To: Ludovic =?iso-8859-1?Q?Court=E8s?= Content-Disposition: inline In-Reply-To: <874psrwf5m.fsf@laas.fr> User-Agent: Mutt/1.4.2.1i X-NAI-Spam-Rules: 1 Rules triggered BAYES_00=-2.5 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:5670 Archived-At: Hi, On Nov 22 06:43, Ludovic Courtès wrote: > A "module" object is (roughly) little more than a hash table (where > symbols of global variables are looked up) and a list of modules > depended on. > > `make-module' is the constructor of module objects: it creates, a new, > empty module, with no dependencies and where no bindings are defined > (not even `lambda', `let', etc.) In turn, `module-use-interfaces!' > modifies a module (the first argument) in order to have it depend on a > number of modules (the second and following arguments). > > The term "interface" refers to what a module exposes for use by other > modules, i.e., what it exports (more precisely, this is the "public" > interface). Yeah, I figured those out from ice-9/boot-9.scm and modules.c too. > And finally, `the-root-module' is, well, the "root" module of Guile, > i.e., the one that contains all the bindings that are visible "by > default". > > > I don't want to be lazy but... Can you please explain a bit more about > > the above usage of modules? For instance, you said, I can bind that > > [thing] to some variable in C. But then how will I use it? > > Say you have C variable "my_module" bound to a module created as > explained above. Then, you can evaluate expression in the context of > that module as follows: > > SCM result, expr; > > expr = scm_list_3 (scm_from_locale_symbol ("+"), > scm_from_int (2), scm_from_int (2)); > result = scm_eval (expr, my_module); > > This is maybe a bit terse but I hope it helps. Thanks so much for your kindly help. They all really helped. (As a proof, see CVS commits of the PL/scheme project. ;-) Regards. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user