From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.user Subject: Re: Problem with modules in Guile 2.0 Date: Wed, 07 Mar 2012 21:01:32 -0500 Message-ID: <87obs7vojn.fsf@netris.org> References: <54183C89-DE93-417E-84EC-5C454E56EE35@gmail.com> <87eht4yww5.fsf@pobox.com> <79B073AF-B3A8-46E0-A047-C4F5686E167E@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1331172235 28508 80.91.229.3 (8 Mar 2012 02:03:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 8 Mar 2012 02:03:55 +0000 (UTC) Cc: guile-user@gnu.org To: Gubinelli Massimiliano Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Mar 08 03:03:55 2012 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S5Shr-0004bV-Vs for guile-user@m.gmane.org; Thu, 08 Mar 2012 03:03:52 +0100 Original-Received: from localhost ([::1]:43171 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5Shr-0002DM-2T for guile-user@m.gmane.org; Wed, 07 Mar 2012 21:03:51 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:51616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5Shm-0002D3-6M for guile-user@gnu.org; Wed, 07 Mar 2012 21:03:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5Shk-0001Xr-4v for guile-user@gnu.org; Wed, 07 Mar 2012 21:03:45 -0500 Original-Received: from world.peace.net ([96.39.62.75]:49020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5Shk-0001XK-03 for guile-user@gnu.org; Wed, 07 Mar 2012 21:03:44 -0500 Original-Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1S5Sha-0000JA-HH; Wed, 07 Mar 2012 21:03:34 -0500 In-Reply-To: <79B073AF-B3A8-46E0-A047-C4F5686E167E@gmail.com> (Gubinelli Massimiliano's message of "Wed, 7 Mar 2012 23:52:57 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 96.39.62.75 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:9323 Archived-At: Gubinelli Massimiliano writes: > Thanks for the prompt reply to both of you. However the proposed > solution do not work in my case. I think it _did_ solve your original problem, but now you have moved on to other unrelated problems. > After implementing the > begin-for-syntax alternative I now get > > scheme@(guile-user)> (load "main.scm") > ;;; compiling /Users/mgubi/t/build-64-guile-2.0/test-modules/main.scm > ;;; note: source file /Users/mgubi/t/build-64-guile-2.0/test-modules/test-modules.scm > ;;; newer than compiled > /Users/mgubi/.cache/guile/ccache/2.0-LE-8-2.0/Users/mgubi/t/build-64-guile-2.0/test-modules/test-modules.scm.go > ;;; compiling /Users/mgubi/t/build-64-guile-2.0/test-modules/test-modules.scm > ;;; > /Users/mgubi/t/build-64-guile-2.0/test-modules/test-modules.scm:15:34: > warning: possibly unbound variable `compile-interface-spec' Note that 'compile-interface-spec' was an undocumented internal procedure of Guile 1.x, and no longer exists in Guile 2. > ;;; /Users/mgubi/t/build-64-guile-2.0/test-modules/test-modules.scm:32:11: warning: possibly unbound variable `:use' > ;;; /Users/mgubi/t/build-64-guile-2.0/test-modules/test-modules.scm:33:11: warning: possibly unbound variable `:inherit' > ;;; /Users/mgubi/t/build-64-guile-2.0/test-modules/test-modules.scm:34:11: warning: possibly unbound variable `:export' In order to use the shorter keyword syntax ':use' (instead of '#:use'), you must set the prefix keywords reader option. Put the following at the beginning of your 'begin-for-syntax' form: (read-set! keywords 'prefix) > ;;; compiled /Users/mgubi/.cache/guile/ccache/2.0-LE-8-2.0/Users/mgubi/t/build-64-guile-2.0/test-modules/test-modules.scm.go > ;;; WARNING: compilation of /Users/mgubi/t/build-64-guile-2.0/test-modules/main.scm failed: > ;;; ERROR: No variable named %module-public-interface in # > ERROR: In procedure scm-error: > ERROR: No variable named %module-public-interface in # > > Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. > scheme@(guile-user) [1]> > > if I understand correctly this backtrace it seems that the module is > not completely loaded at compile time and there is not public > interface available. How can I force the evaluation of the loaded > modules in order to get a list of exported symbols? I cannot reproduce this. When I try using your example code, Guile 2.0.5 tries to compile (sub mymodule). Are you sure that you remembered to set GUILE_LOAD_PATH during this test run? This is what I see: GNU Guile 2.0.5 Copyright (C) 1995-2012 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> (load "main.scm") ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /home/mhw/guile-modules/main.scm ;;; compiling /home/mhw/guile-modules/./test-modules.scm ;;; test-modules.scm:15:34: warning: possibly unbound variable `compile-interface-spec' ;;; compiled /home/mhw/.cache/guile/ccache/2.0-LE-4-2.0/home/mhw/guile-modules/test-modules.scm.go ;;; compiling /home/mhw/guile-modules/sub/mymodule.scm ;;; sub/mymodule.scm:1:0: warning: possibly unbound variable `texmacs-module' ;;; sub/mymodule.scm:1:16: warning: possibly unbound variable `sub' ;;; sub/mymodule.scm:1:16: warning: possibly unbound variable `mymodule' ;;; compiled /home/mhw/.cache/guile/ccache/2.0-LE-4-2.0/home/mhw/guile-modules/sub/mymodule.scm.go ;;; WARNING: compilation of /home/mhw/guile-modules/main.scm failed: ;;; ERROR: In procedure module-lookup: Unbound variable: texmacs-module sub/mymodule.scm:1:0: In procedure #: sub/mymodule.scm:1:0: In procedure module-lookup: Unbound variable: texmacs-module Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(#{ g435}#) [1]> and the problem here is that the compilation of sub/mymodule.scm fails because the 'texmacs-module' macro was used before it was imported into that module. Initially, a module imports only the (guile) module. If you want to use a non-standard module declaration like 'texmacs-module' at the top of a module, you'll need to add that binding to the (guile) module. Best, Mark