From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Rob Browning Newsgroups: gmane.lisp.guile.devel Subject: Re: scm_* API extension? [was] scm_* API question Date: Wed, 31 Jul 2002 16:59:35 -0500 Sender: guile-devel-admin@gnu.org Message-ID: <87ado7a794.fsf@raven.i.defaultvalue.org> References: <20020730121436.GA4465@www> <20020730200929.A18106@kiwi.pyrotechnics.com> <20020731100300.GC5661@www> <20020731182124.GD6561@www> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1028152778 14324 127.0.0.1 (31 Jul 2002 21:59:38 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 31 Jul 2002 21:59:38 +0000 (UTC) Cc: Marius Vollmer , guile-devel@gnu.org Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17a1VH-0003iv-00 for ; Wed, 31 Jul 2002 23:59:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17a1Vm-0007Wi-00; Wed, 31 Jul 2002 18:00:06 -0400 Original-Received: from dsl-209-87-109-2.constant.com ([209.87.109.2] helo=defaultvalue.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17a1VJ-0007T1-00 for ; Wed, 31 Jul 2002 17:59:37 -0400 Original-Received: from raven.i.defaultvalue.org (raven.i.defaultvalue.org [192.168.1.7]) by defaultvalue.org (Postfix) with ESMTP id BB9223D5C; Wed, 31 Jul 2002 16:59:36 -0500 (CDT) Original-Received: by raven.i.defaultvalue.org (Postfix, from userid 1000) id 01D9F1457; Wed, 31 Jul 2002 16:59:35 -0500 (CDT) Original-To: rm@fabula.de In-Reply-To: <20020731182124.GD6561@www> (rm@fabula.de's message of "Wed, 31 Jul 2002 20:21:24 +0200") Original-Lines: 74 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-pc-linux-gnu) 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:906 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:906 rm@fabula.de writes: > GuileBind a-symbol '(arbitrary (guile data) structure) > i.e. i want guile to 'read' from the configuration file and bind > 'a-symbol' to whatever was read. As a side note: as a quick hack i > put the symbol into the module but i'd rather like to use something > like an environment i can set up myself (i hope setting up an > environment isn't to expensive performance wise), but i have way too > little understanding about how to do this right now. But it would > make a _way_ cool web environment -- full control over the env. > means secure execution as well as probably some nice passing on of > context. You may want to look at ice-9/safe.scm and ice-9/safe-r5rs.scm. You can see how to at least create your own anonymous modules: (use-modules (ice-9 safe)) (define my-module (make-safe-module)) (eval 'car my-module) # or if you want an even more limited envt: (use-modules (ice-9 safe-r5rs)) (define my-module (null-environment 5)) (eval 'if my-module) # (eval 'car my-module) ABORT: (unbound-variable) and then: (module-define! my-module 'my-func (lambda (x) x)) etc. There's also a module-ref function and a module-use! function... > BTW, one reasons i do use the module system is the impicit cacheing > i get: a module gets loaded only once, and that does make a > difference in response time compared to the initial 'eval a file per > request' aproach of mod_guile. Well that may or may not be the right thing to do if you're *just* using the module system for the caching. In that case, you may be better off to implement the caching yourself (via a hash table or whatever) and leave the module system to more static modules. For example, depending on what you're wanting to do, you might want to allow different requests to be handled inside separate namespaces, though they're all using a common set of code. OTTOMH, I think you could do this by putting the common functionality into a module, say foo.scm, then doing something like this for *each* request: (use-modules (foo)) (define foo-module (resolve-module '(foo))) ;; For each request... (define next-request-envt (make-safe-module)) (module-use! next-request-envt (module-public-interface foo-module)) (define request-form (list handler-sym current-url-string)) (eval request-form next-request-envt) Marius, etc. Please correct any inaccuracies above -- I'm just going from what I've gathered while poking around. I suspect we need more thorough documentation of the acceptable usage of the anonymous module stuff. -- Rob Browning rlb @defaultvalue.org, @linuxdevel.com, and @debian.org Previously @cs.utexas.edu GPG=1C58 8B2C FB5E 3F64 EA5C 64AE 78FE E5FE F0CB A0AD _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel