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 15:11:42 -0500 Message-ID: <87vcmguq69.fsf@netris.org> References: <54183C89-DE93-417E-84EC-5C454E56EE35@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1331151287 11764 80.91.229.3 (7 Mar 2012 20:14:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 7 Mar 2012 20:14:47 +0000 (UTC) Cc: guile-user@gnu.org To: Gubinelli Massimiliano Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Mar 07 21:14:44 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 1S5NFs-0000sG-71 for guile-user@m.gmane.org; Wed, 07 Mar 2012 21:14:36 +0100 Original-Received: from localhost ([::1]:43669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5NFr-0001Vw-Gz for guile-user@m.gmane.org; Wed, 07 Mar 2012 15:14:35 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:45635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5NFi-0001Vj-Tk for guile-user@gnu.org; Wed, 07 Mar 2012 15:14:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5NFI-0005ry-BJ for guile-user@gnu.org; Wed, 07 Mar 2012 15:14:26 -0500 Original-Received: from world.peace.net ([96.39.62.75]:48790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5NFI-0005rZ-02 for guile-user@gnu.org; Wed, 07 Mar 2012 15:14:00 -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 1S5NF9-0007yl-9L; Wed, 07 Mar 2012 15:13:51 -0500 In-Reply-To: <54183C89-DE93-417E-84EC-5C454E56EE35@gmail.com> (Gubinelli Massimiliano's message of "Tue, 6 Mar 2012 22:48:22 +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:9320 Archived-At: Gubinelli Massimiliano writes: > 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 > > (load "test-modules.scm") > > (inherit-modules (sub mymodule)) > > (display (pippo 10 20)) (display "\n") The problem is that 'load' is done only at run time, not compile time, so the compiler does not have access to the macro 'inherit-modules'. Since Guile 1.x did not have a compiler, this was not an issue. One easy solution would be to use the 'include' macro instead. 'include' acts like '#include' in C: it splices the entire contents of the included file in place of the 'include' form, at compilation time. 'include' did not exist in Guile 1.x, but you could do something like this to make 'include' an alias for 'load' in Guile 1.x: (cond-expand (guile-2 #f) (guile (define include load))) Best, Mark