Hi Shantanu, I had to play with this because it seemed like for some reason you were trying to call it on my name :)
So far one thing I've isolated is that if you cut out the function calls it will compile the macro: (defmacro bar [a] (let [b (keyword a) f (fn [& args] b)] `(deftype ~b [] clojure.lang.ILookup (valAt [this# k#] ) (valAt [this# k# d#] )))) user=> (bar alex) user.alex On Sat, Apr 28, 2012 at 11:43 AM, Shantanu Kumar <kumar.shant...@gmail.com>wrote: > Hi, > > I am running into error when using macros with deftype. For example, > when I use the macro `foo` it works fine: > > (defmacro foo > [a] > (let [b (keyword a)] > `(do ~b))) > > (foo alex) > => :b > whereas, when I use the macro `bar`: > > (defmacro bar > [a] > (let [b (keyword a) > f (fn [& args] b)] > `(deftype ~a [] > clojure.lang.ILookup > (valAt [this# k#] (~f this# k#)) > (valAt [this# k# d#] (~f this# k# d#))))) > > (bar alex) > > I get the following error: > CompilerException java.lang.ExceptionInInitializerError, compiling: > (NO_SOURCE_PATH:87) > > Can somebody help me understand what am I doing wrong here. > > Shantanu > > -- > 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 -- 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