From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: bug#12202: psyntax defeats autoload Date: Tue, 05 Mar 2013 17:45:21 +0100 Message-ID: <87wqtlvlr2.fsf@pobox.com> References: <87y5lhmowt.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1362509700 31572 80.91.229.3 (5 Mar 2013 18:55:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Mar 2013 18:55:00 +0000 (UTC) Cc: 12202@debbugs.gnu.org To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Mar 05 19:55:23 2013 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 1UCx1G-00082z-2q for guile-bugs@m.gmane.org; Tue, 05 Mar 2013 19:55:22 +0100 Original-Received: from localhost ([::1]:38036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCx0u-00023L-J4 for guile-bugs@m.gmane.org; Tue, 05 Mar 2013 13:55:00 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:60421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCx0i-00020a-R5 for bug-guile@gnu.org; Tue, 05 Mar 2013 13:54:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCx0c-0002uT-Qs for bug-guile@gnu.org; Tue, 05 Mar 2013 13:54:48 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCx0c-0002uP-N8 for bug-guile@gnu.org; Tue, 05 Mar 2013 13:54:42 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UCx0y-0000Zo-3i for bug-guile@gnu.org; Tue, 05 Mar 2013 13:55:04 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andy Wingo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 05 Mar 2013 18:55:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12202 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 12202-submit@debbugs.gnu.org id=B12202.13625096481981 (code B ref 12202); Tue, 05 Mar 2013 18:55:04 +0000 Original-Received: (at 12202) by debbugs.gnu.org; 5 Mar 2013 18:54:08 +0000 Original-Received: from localhost ([127.0.0.1]:32813 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UCx00-0000Vh-T2 for submit@debbugs.gnu.org; Tue, 05 Mar 2013 13:54:07 -0500 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:37891 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UCwzp-0000Uv-9u for 12202@debbugs.gnu.org; Tue, 05 Mar 2013 13:53:54 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 68E87BF7C; Tue, 5 Mar 2013 13:53:31 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=FpzXK096xpxp PYwSY7WsL9SOCdo=; b=wV7JrZ25txle/wyNugk43HV6XiBsV/oasWXyPq9stOJx kWAkXDujEhzdo0MP0RUY/I5JU77HbtfBlUlLKmRblG5400NAxD4DeuZbtUHqvrI5 zhmDkbc6U+K51dtywvwDr1Anax5gsxhgImOpKhvgUv4jfBBUDJd8zOZZyVH8KBE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=OSpF5T v1FopBJ/D0L5SSvKdby/HlThnMJb1Z4j25le+ZcdPU8GTcU0oeZ7KoVMjwP0Az/H gqy1cJgxaibARahGEHLNq0GGhEDFuPKA2UnyhO7mLHisqZHcrJXgWOUhg+DzQ8wf E747VXU8liS1bL8rplxIIwFKLATZfGrI6kDoo= Original-Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 620C8BF7B; Tue, 5 Mar 2013 13:53:31 -0500 (EST) Original-Received: from badger (unknown [217.91.84.86]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id BC818BF79; Tue, 5 Mar 2013 13:53:30 -0500 (EST) In-Reply-To: <87y5lhmowt.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Tue, 14 Aug 2012 18:14:26 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-Pobox-Relay-ID: F91D718E-85C5-11E2-84EE-59240E5B5709-02397024!a-pb-sasl-quonix.pobox.com 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.x 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:6836 Archived-At: On Tue 14 Aug 2012 18:14, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > (define-module (foo) #:autoload (does-not-exist) (baz)) > (define (chbouib) (baz)) > (pk 'hello) > > Trying to evaluate it fails this way: > > $ guile --no-auto-compile t.scm=20 > 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) > > ... which defeats the whole purpose of autoloads. > > What about something along these lines (untested)? This is a great idea. We should assume that autoloads are not macros. Not sure we can change it in 2.0 though, because there could be uses of autoloaded macros. However your patch won't work: > 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" s= ymbol)) > - (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)))))))))))) >=20=20 because the module-kind of the module will never be `autoload' here. As you can see in your backtrace, the module-kind is `directory' -- the autoload only ends up getting loaded while grovelling (foo)'s import array. Andy --=20 http://wingolog.org/