The problem is in embedding an actual function object instead of a
form which creates the function object. That results in a form which
can't be read properly and thus the cryptic error.

Regards,
BG

On Sat, Apr 28, 2012 at 9:13 PM, 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



-- 
Baishampayan Ghose
b.ghose at gmail.com

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