VerifyError with symbol metadata, macros, and defrecord

9 views
Skip to first unread message

Constantine Vetoshev

unread,
Sep 26, 2010, 2:47:45 PM9/26/10
to Clojure
In Clojure 1.2, compiling the code below blows up with:

error: java.lang.VerifyError: (class: t1/core/One, method: <clinit>
signature:
()V) Incompatible argument to function (core.clj:11)

Something about this problem causes damage to the running Clojure
process. Once
the exception happens, changing the macro to a working version will
not make the
sample work with the tagged symbol, almost as if the symbol 'one
(below) is
somehow corrupt. You either need to start a new REPL, or try to invoke
the macro
with a different tagged symbol.

I'm honestly not even sure if (1) I don't understand something, (2)
this is a
bug in Clojure, or (3) this is just a remarkably unhelpful error
message.


(ns t1.core)

(defmacro mac1 [name properties]
;; does not work:
(let [key-info (keyword (first (filter #(meta %) properties)))]
;; works:
;(let [key-info (keyword (str (first (filter #(meta %)
properties))))]
(prn key-info)
;; commenting out the defrecord below also makes this work:
`(defrecord ~name ~properties)))

(mac1 One [^:key one, two])
Reply all
Reply to author
Forward
0 new messages