[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guile module system problem
From: |
Neil Jerram |
Subject: |
Re: Guile module system problem |
Date: |
Thu, 05 Feb 2009 22:18:33 +0000 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
Panicz Maciej Godek <address@hidden> 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 #<variable 7fd6dd0ca610 value:
>>> #<primitive-procedure slot-ref>>
> 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
>From f8d80072759961eaecfa95e4f9446a5dc1016ca8 Mon Sep 17 00:00:00 2001
From: Neil Jerram <address@hidden>
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Guile module system problem,
Neil Jerram <=