From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: Re: Guile module system problem Date: Thu, 05 Feb 2009 22:18:33 +0000 Message-ID: <87skmsh6iu.fsf@arudy.ossau.uklinux.net> References: <1eb53f5d0901200218n227d2db0le7f511bf7f8fbf57@mail.gmail.com> <49dd78620901200415w2b013eeiff6062136f0f07de@mail.gmail.com> <1eb53f5d0901200507v39639fbq1577f53b143b08a3@mail.gmail.com> <1eb53f5d0901200852h4c7c29afm64df2c77db09a42a@mail.gmail.com> <87vds8a9ad.fsf@gnu.org> <1eb53f5d0901210951x358d1569se0c4f646f3bc8b2b@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1233872396 2758 80.91.229.12 (5 Feb 2009 22:19:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Feb 2009 22:19:56 +0000 (UTC) Cc: Ludovic =?iso-8859-1?Q?Court=E8s?= , guile-user@gnu.org, Guile Development To: Panicz Maciej Godek Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Feb 05 23:21:10 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LVCaj-0007oQ-Rx for guile-devel@m.gmane.org; Thu, 05 Feb 2009 23:21:04 +0100 Original-Received: from localhost ([127.0.0.1]:60158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LVCZQ-0001O0-Bt for guile-devel@m.gmane.org; Thu, 05 Feb 2009 17:19:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LVCYb-00016V-49 for guile-devel@gnu.org; Thu, 05 Feb 2009 17:18:49 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LVCYX-00015S-EX for guile-devel@gnu.org; Thu, 05 Feb 2009 17:18:48 -0500 Original-Received: from [199.232.76.173] (port=49700 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LVCYX-00015M-39; Thu, 05 Feb 2009 17:18:45 -0500 Original-Received: from mail3.uklinux.net ([80.84.72.33]:60607) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LVCYN-0003sy-VO; Thu, 05 Feb 2009 17:18:36 -0500 Original-Received: from arudy (host86-157-180-39.range86-157.btcentralplus.com [86.157.180.39]) by mail3.uklinux.net (Postfix) with ESMTP id 87D4C1F6634; Thu, 5 Feb 2009 22:18:34 +0000 (GMT) Original-Received: from arudy.ossau.uklinux.net (arudy [127.0.0.1]) by arudy (Postfix) with ESMTP id 0698438012; Thu, 5 Feb 2009 22:18:33 +0000 (GMT) In-Reply-To: <1eb53f5d0901210951x358d1569se0c4f646f3bc8b2b@mail.gmail.com> (Panicz Maciej Godek's message of "Wed\, 21 Jan 2009 18\:51\:11 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8137 gmane.lisp.guile.user:7147 Archived-At: --=-=-= Panicz Maciej Godek writes: >>> (define slot-ref (make-procedure-with-setter (@ (oop goops) slot-ref) >>> slot-set!)) >>> >>> and the error I get when I try to use that module, is: >>> ERROR: invalid syntax #>> #> > I've found a possible reason, though. I didn't write that in > the module definition I also use syntax from (ice-9 syncase), > so it actually looks more like this: > (define-module (modules goose) > :use-syntax (ice-9 syncase) > :use-module (oop goops) > :replace (slot-ref)) > > Now you should get the error right :) > (sorry for this understatement) > > When I place (use-syntax (ice-9 syncase)) *after* the > slot-ref definition, it seems to work well. I have a fix for this, which I think is correct. (Not 100% sure, as syncase is pretty tricky.) Please let me know if you have any comments. Regards, Neil --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0002-Allow-to-work-with-ice-9-syncase.patch >From f8d80072759961eaecfa95e4f9446a5dc1016ca8 Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Thu, 5 Feb 2009 22:11:26 +0000 Subject: [PATCH] Allow @ to work with (ice-9 syncase) (Reported by Panicz Maciej Godek.) * test-suite/tests/syncase.test ("@ works with syncase"): New test. * ice-9/syncase.scm (guile-macro): When a Guile macro transformer produces a variable, don't pass it through sc-expand. --- NEWS | 7 +++++++ THANKS | 1 + ice-9/syncase.scm | 8 +++++--- test-suite/tests/syncase.test | 3 +++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 71e9dc0..f3362ce 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,13 @@ Changes in 1.8.7 (since 1.8.6) ** Fix build problem when scm_t_timespec is different from struct timespec ** Fix build when compiled with -Wundef -Werror +** Allow @ macro to work with (ice-9 syncase) + +Previously, use of the @ macro in a module whose code is being +transformed by (ice-9 syncase) would cause an "Invalid syntax" error. +Now it works as you would expect (giving the value of the specified +module binding). + Changes in 1.8.6 (since 1.8.5) diff --git a/THANKS b/THANKS index feafc12..84c957b 100644 --- a/THANKS +++ b/THANKS @@ -41,6 +41,7 @@ For fixes or providing information which led to a fix: Peter Gavin Eric Gillespie, Jr Didier Godefroy + Panicz Maciej Godek John Goerzen Mike Gran Szavai Gyula diff --git a/ice-9/syncase.scm b/ice-9/syncase.scm index 6ee4d16..39cf273 100644 --- a/ice-9/syncase.scm +++ b/ice-9/syncase.scm @@ -146,9 +146,11 @@ (let ((e ((macro-transformer m) e (append r (list eval-closure))))) - (if (null? r) - (sc-expand e) - (sc-chi e r w)))))))))) + (if (variable? e) + e + (if (null? r) + (sc-expand e) + (sc-chi e r w))))))))))) (define generated-symbols (make-weak-key-hash-table 1019)) diff --git a/test-suite/tests/syncase.test b/test-suite/tests/syncase.test index 1184f7b..c681fc3 100644 --- a/test-suite/tests/syncase.test +++ b/test-suite/tests/syncase.test @@ -34,3 +34,6 @@ (pass-if "basic syncase macro" (= (plus 1 2 3) (+ 1 2 3))) + +(pass-if "@ works with syncase" + (eq? run-test (@ (test-suite lib) run-test))) -- 1.5.6.5 --=-=-=--