From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Gubinelli Massimiliano Newsgroups: gmane.lisp.guile.user Subject: Problem with modules in Guile 2.0 Date: Tue, 6 Mar 2012 22:48:22 +0100 Message-ID: <54183C89-DE93-417E-84EC-5C454E56EE35@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1331070521 7355 80.91.229.3 (6 Mar 2012 21:48:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Mar 2012 21:48:41 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Mar 06 22:48:41 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 1S52FK-00073h-3z for guile-user@m.gmane.org; Tue, 06 Mar 2012 22:48:38 +0100 Original-Received: from localhost ([::1]:54039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S52FJ-0001FR-9I for guile-user@m.gmane.org; Tue, 06 Mar 2012 16:48:37 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:51743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S52FD-0001FK-QF for guile-user@gnu.org; Tue, 06 Mar 2012 16:48:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S52FB-0001oo-Sx for guile-user@gnu.org; Tue, 06 Mar 2012 16:48:31 -0500 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:56225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S52FB-0001ob-Gg for guile-user@gnu.org; Tue, 06 Mar 2012 16:48:29 -0500 Original-Received: by werj55 with SMTP id j55so4375261wer.0 for ; Tue, 06 Mar 2012 13:48:27 -0800 (PST) Received-SPF: pass (google.com: domain of m.gubinelli@gmail.com designates 10.180.79.231 as permitted sender) client-ip=10.180.79.231; Authentication-Results: mr.google.com; spf=pass (google.com: domain of m.gubinelli@gmail.com designates 10.180.79.231 as permitted sender) smtp.mail=m.gubinelli@gmail.com; dkim=pass header.i=m.gubinelli@gmail.com Original-Received: from mr.google.com ([10.180.79.231]) by 10.180.79.231 with SMTP id m7mr14206677wix.11.1331070507524 (num_hops = 1); Tue, 06 Mar 2012 13:48:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:date:message-id :to:mime-version:x-mailer; bh=0wuijOyB05P5SbjEys+VvC80CykazFg24c55Ju4x1Nc=; b=Y0xwlVlZ8qU1N4Uu98V/Agc1xHJ1S02IjsX54d0WcWkFwqs7hx6I5AWd2OpxyOFLEf s+2unfG4gKJ5tWhuXJ8fqYXdi5Z9Y8AzVMkwTBgVT7VqO2wp3quw8+9XPkYSd/2rLMW6 iBNY/Opid0pLLZnD+nY9viBzKn9q35Igla354L6ECtdWGdmwFgRd3Dd6BxgjFt3Pd9xM n8rFjkNhQFynG7LRemp5GfGSAjbT8wafw/y1iMTzNNawmEr/X7LxoQRCPBSpeIx1+dyO dUeYh+w5pFDUHBYAk7xY9s0EqPVYXZjEpKqQVxNX4DryiTPOKDsslLeoZWzGH9Xtpy4Q H9zQ== Original-Received: by 10.180.79.231 with SMTP id m7mr11192945wix.11.1331070507457; Tue, 06 Mar 2012 13:48:27 -0800 (PST) Original-Received: from [10.1.10.20] ([196.203.29.245]) by mx.google.com with ESMTPS id ep17sm30027331wid.2.2012.03.06.13.48.25 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Mar 2012 13:48:26 -0800 (PST) X-Mailer: Apple Mail (2.1257) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.169 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:9318 Archived-At: Hi all, I stumbled on a strange behaviour of Guile 2.0, I have the following = three files: main.scm, test-module.scm and sub/mymodule.scm which = respectively contain ---- main.scm=20 (load "test-modules.scm") (inherit-modules (sub mymodule)) (display (pippo 10 20)) (display "\n") ---- sub/mymodule.scm=20 (texmacs-module (sub mymodule)) (display "Loading my module\n") (define-public (pippo a b) (+ a b)) =20 =20 ---- test-modules.scm=20 (define texmacs-user (current-module)) (define temp-module (current-module)) (define-macro (with-module module . body) `(begin (set! temp-module (current-module)) (set-current-module ,module) ,@body (set-current-module temp-module))) (define-macro (import-from . modules) `(process-use-modules (list ,@(map (lambda (m) `(list ,@(compile-interface-spec m))) modules)))) =20 (define-macro (inherit-modules . which-list) (define (module-exports which) (let* ((m (resolve-module which)) (m-public (module-ref m '%module-public-interface))) (module-map (lambda (sym var) sym) m-public))) (let ((l (apply append (map module-exports which-list)))) `(begin (use-modules ,@which-list) (re-export ,@l)))) (define-macro (texmacs-module name . options) (define (transform action) (cond ((not (pair? action)) (noop)) ((equal? (car action) :use) (cons 'use-modules (cdr action))) ((equal? (car action) :inherit) (cons 'inherit-modules (cdr = action))) ((equal? (car action) :export) (display "Warning] The option :export is no longer = supported\n") (display " ] Please use tm-define instead\n")) (else '(noop)))) (let ((l (map-in-order transform options))) (set! l (cons `(module-use! (current-module) ,texmacs-user) l)) (display "loading ") (display name) (display "\n") `(begin (define-module ,name) ,@l))) ----------- the directory structure is the following ./main.scm ./test-modules.scm ./sub/mymodule.scm these are pieces from a larger software (GNU TeXmacs) which used to work = with any version of Guile up to 1.8 and fail to work with Guile 2.0. In = an interactive session, after setting the GUILE_LOAD_PATH to the working = directory I get --------------------------- Jurgen:test-modules mgubi$ GUILE_LOAD_PATH=3D$PWD guile 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: source file = /Users/mgubi/t/build-64-guile-2.0/test-modules/main.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/main.scm.go ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /Users/mgubi/t/build-64-guile-2.0/test-modules/main.scm ;;; main.scm:3:0: warning: possibly unbound variable `inherit-modules' ;;; main.scm:3:17: warning: possibly unbound variable `sub' ;;; main.scm:3:17: warning: possibly unbound variable `mymodule' ;;; main.scm:5:9: warning: possibly unbound variable `pippo' ;;; compiled = /Users/mgubi/.cache/guile/ccache/2.0-LE-8-2.0/Users/mgubi/t/build-64-guile= -2.0/test-modules/main.scm.go main.scm:3:17: In procedure #: main.scm:3:17: In procedure module-lookup: Unbound variable: sub Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [1]>=20 --------------------------- The same code work fine with 1.6: Jurgen:test-modules mgubi$ GUILE_LOAD_PATH=3D$PWD = ../../build-64-guile-1.6.8/usr/bin/guile guile> (version) "1.6.8" guile> (load "main.scm") loading (sub mymodule) Loading my module 30 guile>=20 --------------------------- Somebody has a clue on how to fix this and what is the origin of the = problem? Thanks, Massimiliano Gubinelli