On 13 Sep 2010, at 00:24, icemaze wrote:

(use 'clojure.contrib.macro-utils)

(defn bug? []
 (with-symbol-macros
   (case 0
     0 1)))

The REPL prints:
java.lang.ClassCastException: clojure.lang.PersistentVector cannot be
cast to clojure.lang.MapEntry (NO_SOURCE_FILE:4)

Can anyone confirm this, please?

I am not sure the problem comes from with-symbol-macros:

user=> (macroexpand-1 '(case 0 0 1))
(clojure.core/let [G__2400 0] (case* G__2400 0 1 0 0 (throw (java.lang.IllegalArgumentException. (clojure.core/str "No matching clause: " G__2400))) {0 [0 1]} false)) user=> (clojure.core/let [G__2400 0] (case* G__2400 0 1 0 0 (throw (java.lang.IllegalArgumentException. (clojure.core/str "No matching clause: " G__2400))) {0 [0 1]} false)) java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.MapEntry (NO_SOURCE_FILE:2)

This suggests that something weird is going on in the interaction between the case macro and the case* special form that implements it. I don't have the time to look into this right now, unfortunately.

Konrad.

--
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

Reply via email to