From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Julian Graham Newsgroups: gmane.lisp.guile.user Subject: dynamic module creation Date: Sun, 1 Feb 2009 02:58:36 -0500 Message-ID: <2bc5f8210901312358v1f341027qb973b92a5c9d496b@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1233475146 21779 80.91.229.12 (1 Feb 2009 07:59:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Feb 2009 07:59:06 +0000 (UTC) To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Feb 01 09:00:20 2009 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LTXFb-0000ED-0u for guile-user@m.gmane.org; Sun, 01 Feb 2009 09:00:19 +0100 Original-Received: from localhost ([127.0.0.1]:46918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LTXEI-00053b-D7 for guile-user@m.gmane.org; Sun, 01 Feb 2009 02:58:58 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LTXE0-000525-MD for guile-user@gnu.org; Sun, 01 Feb 2009 02:58:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LTXDz-00050R-A5 for guile-user@gnu.org; Sun, 01 Feb 2009 02:58:40 -0500 Original-Received: from [199.232.76.173] (port=46989 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LTXDz-00050N-3V for guile-user@gnu.org; Sun, 01 Feb 2009 02:58:39 -0500 Original-Received: from mx20.gnu.org ([199.232.41.8]:49937) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LTXDy-00040p-Gc for guile-user@gnu.org; Sun, 01 Feb 2009 02:58:38 -0500 Original-Received: from mail-gx0-f20.google.com ([209.85.217.20]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LTXDx-0006y2-Hm for guile-user@gnu.org; Sun, 01 Feb 2009 02:58:37 -0500 Original-Received: by gxk13 with SMTP id 13so906598gxk.18 for ; Sat, 31 Jan 2009 23:58:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=jJl3yCxz30SB0fJMSEmwjhD7DS4glBiqgzk/of1fim8=; b=Zuv5sYBtRFN4Z7hP4jMnHNIuxJQV85wGLuhK6tMl7+qx3MoeMLiS+DYkeuwVNe224g ICI5f9vjHgYp4q+4wdOYaYH556zw6JX5F3xq3/C6qEYYnNhN9YKU6lCFmkwQZq51aZft k6D4x/vCQalOV2Ce6gwAmxcZaleVNUSTVj8aU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=vB0gBVDV05Ci9O8K9fgUYeDI09CYvei8+7JqjlwQgcfln3lPnVhAsZ/3X8P4quTPDQ a4HRwdXbxq120n48SCA1NMBy47VRxjhZBbtMeyxg3Q/ReR13hPvDyR9hp18Ge3r2ZPVh SiQrcMkCsDLKnXpmgrsR1vk3jbTPvOQdvhxv0= Original-Received: by 10.151.103.11 with SMTP id f11mr3147059ybm.21.1233475116346; Sat, 31 Jan 2009 23:58:36 -0800 (PST) X-detected-kernel: by mx20.gnu.org: Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:7129 Archived-At: Hi Guilers, Is there a way to create a module at runtime and evaluate expressions in it using a dynamically-created set of module imports? I want to do something along the lines of: (save-module-excursion (lambda () (define-module (my-dynamic-module-name) #:use-module (a-module-i-decided-to-include-at-runtime) #:pure) (do-something))) ...except `define-module' doesn't like being called from anywhere except the top level. I also tried `resolve-module', the documentation for which says: Find the module named NAME and return it. When it has not already been defined, try to auto-load it. When it can't be found that way either, create an empty module. This works as advertised -- it really does create an empty module, but it's completely empty: No core Scheme syntax, not even any syntactic sugar like '@ to help you get at stuff from the core. It's an utterly blank environment. Is there some way to get the module-creation behavior of `resolve-module' but also be able to include stuff from other modules in the resulting environment? Regards, Julian