Hi, Am Donnerstag, 21. Februar 2013 16:08:36 UTC+1 schrieb Jim foo.bar: > > I apologise...this works almost perfectly: > > (defmacro defcomponent [name co] > `(let [c# ~co] > (assert (component? c#) "Not a valid IComponent") > (def ~name c#))) > > the only slight problem is the error thrown which has the gensym symbol in > the flailing condition...Well, I can't have everything can I? :) >
(defmacro defcomponent [name co] `(do (def ~name) (let [c# ~co] (assert (component? c#) "Not a valid IComponent") (alter-var-root! (var ~name) (constantly c#))) (var ~name)))) Since name is an argument to def it can only ever be a literal symbol. Kind regards Meikel -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.