I digged a little and I have a patch. I modified the case* parser in
Compiler.java, so the patch shouldn't affect anything else: I prefer
keeping safe since my knowledge of Clojure internals is limited, but a
more radical solution might be desirable.
The problem seems caused by the way case* gets constructed. The 7th
parameter is a hash-map that is passed directly to the compiler
(Compiler.java). The values of this hash-map are instances of the
MapEntry class.
When a case call is macroexpanded, those MapEntry instances get
printed out as vectors. When they are read back and evaluated, they
become instances of PersistentVector and the compiler barfs. Since
case* arguments are not evaluated there's no way, as far as I know, to
pass a MapEntry object to case* by calling it directly since there's
no such thing as a MapEntry literal.
My patch modifies case* so that it can handle a PersistentVector and
make a new MapEntry from it.
I'll post the patch here directly, since it's only a few lines long. I
hope it's not too rude. It's against git master branch.
--- Compiler.java.orig 2010-09-11 14:35:07.0 +0200
+++ Compiler.java 2010-09-13 12:12:12.033621364 +0200
@@ -7445,7 +7445,13 @@
{
Map.Entry e = (Map.Entry) o;
Integer minhash =
((Number)e.getKey()).intValue();
- MapEntry me = (MapEntry) e.getValue();
+ MapEntry me = null;
+ if (e.getValue() instanceof
PersistentVector) {
+ PersistentVector pv =
(PersistentVector) e.getValue();
+ me = new MapEntry(pv.nth(0),
pv.nth(1));
+ } else {
+ me = (MapEntry) e.getValue();
+ }
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en