From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.bugs Subject: bug#12202: psyntax defeats autoload Date: Tue, 14 Aug 2012 18:14:26 +0200 Message-ID: <87y5lhmowt.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1344961006 20458 80.91.229.3 (14 Aug 2012 16:16:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 14 Aug 2012 16:16:46 +0000 (UTC) To: 12202@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Aug 14 18:16:46 2012 Return-path: Envelope-to: guile-bugs@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 1T1JnL-0001PJ-P1 for guile-bugs@m.gmane.org; Tue, 14 Aug 2012 18:16:40 +0200 Original-Received: from localhost ([::1]:60593 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1JnK-0006OY-LI for guile-bugs@m.gmane.org; Tue, 14 Aug 2012 12:16:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1JnG-0006N6-1p for bug-guile@gnu.org; Tue, 14 Aug 2012 12:16:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1Jn6-0002eo-IT for bug-guile@gnu.org; Tue, 14 Aug 2012 12:16:33 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1Jn6-0002eb-EU for bug-guile@gnu.org; Tue, 14 Aug 2012 12:16:24 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1T1JvS-0001QR-RJ for bug-guile@gnu.org; Tue, 14 Aug 2012 12:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 14 Aug 2012 16:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12202 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13449614915435 (code B ref -1); Tue, 14 Aug 2012 16:25:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Aug 2012 16:24:51 +0000 Original-Received: from localhost ([127.0.0.1]:56557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T1JvG-0001Pb-Lx for submit@debbugs.gnu.org; Tue, 14 Aug 2012 12:24:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60495) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T1JvD-0001PK-DM for submit@debbugs.gnu.org; Tue, 14 Aug 2012 12:24:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1Jmn-0002Or-95 for submit@debbugs.gnu.org; Tue, 14 Aug 2012 12:16:08 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:41897) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1Jmn-0002OR-5w for submit@debbugs.gnu.org; Tue, 14 Aug 2012 12:16:05 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1JlH-00065T-GA for bug-guile@gnu.org; Tue, 14 Aug 2012 12:14:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1JlF-0001CZ-7k for bug-guile@gnu.org; Tue, 14 Aug 2012 12:14:31 -0400 Original-Received: from xanadu.aquilenet.fr ([88.191.123.111]:41629) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1JlF-0001CR-1M for bug-guile@gnu.org; Tue, 14 Aug 2012 12:14:29 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id 10D257C9E for ; Tue, 14 Aug 2012 18:14:27 +0200 (CEST) Original-Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tjo72nJ5YcOv for ; Tue, 14 Aug 2012 18:14:26 +0200 (CEST) Original-Received: from pluto (unknown [193.50.110.192]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id C08BF7B89 for ; Tue, 14 Aug 2012 18:14:26 +0200 (CEST) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 28 Thermidor an 220 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6478 Archived-At: --=-=-= Content-Type: text/plain Hello! Consider this module: --8<---------------cut here---------------start------------->8--- (define-module (foo) #:autoload (does-not-exist) (baz)) (define (chbouib) (baz)) (pk 'hello) --8<---------------cut here---------------end--------------->8--- Trying to evaluate it fails this way: --8<---------------cut here---------------start------------->8--- $ guile --no-auto-compile t.scm Backtrace: In ice-9/boot-9.scm: [...] 292: 3 [get-global-definition-hook baz (hygiene foo)] In unknown file: ?: 2 [module-variable # baz] In ice-9/boot-9.scm: 2732: 1 [b # baz #f] In unknown file: ?: 0 [scm-error misc-error #f ...] ERROR: In procedure scm-error: ERROR: missing interface for module (does-not-exist) --8<---------------cut here---------------end--------------->8--- ... which defeats the whole purpose of autoloads. What about something along these lines (untested)? --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm index 6c264a6..8a30f82 100644 --- a/module/ice-9/psyntax.scm +++ b/module/ice-9/psyntax.scm @@ -289,15 +289,20 @@ (lambda (symbol module) (if (and (not module) (current-module)) (warn "module system is booted, we should have a module" symbol)) - (let ((v (module-variable (if module + (let ((m (if module (resolve-module (cdr module)) - (current-module)) - symbol))) + (current-module)))) + (case (module-kind m) + ((autoload) + ;; don't try to actually load the module + #t) + (else + (let ((v (module-variable m symbol))) (and v (variable-bound? v) (let ((val (variable-ref v))) (and (macro? val) (macro-type val) (cons (macro-type val) - (macro-binding val))))))))) + (macro-binding val)))))))))))) (define (decorate-source e s) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 DQpUaGFua3MsDQpMdWRv4oCZLg0K --=-=-=--