Thanks. If I use syntax-quoting, the error will be checked only at the time of executing the (macro-expanded) code, not at macro-expansion time, like some other checks I am performing. Is it possible to achieve what I want while the macro is called? The checks I am performing are some semantic checks, so maybe this should really be done later? I know metas are only available for IMetas, but my objects will always be clojure maps, so this shouldn't be a problem. Do you think I should apply the metadata to the symbol?
Regards, wujek On Mon, Jan 14, 2013 at 3:34 PM, Jim foo.bar <jimpil1...@gmail.com> wrote: > Of course you should know that built-in java types do not support > meta-data...You need to implement IObj in order to provide meta-data > support to your own types...otherwise use records... > > Jim > > > > On 14/01/13 14:32, Jim foo.bar wrote: > >> On 14/01/13 14:27, wujek.sru...@gmail.com wrote: >> >>> (defmacro with-obj [name] >>> (let [obj-meta (meta name)] >>> (if (or (nil? obj-meta)) ; (not (::my-obj obj-meta))) >>> (throw (IllegalArgumentException. (str name " seems not be our >>> object"))))) >>> `(println "nice")) >>> >>> >> >> Try this: >> >> >> (defmacro with-obj [name] >> `(if-let [obj-meta# (meta ~name)] >> (println "nice") >> (throw (IllegalArgumentException. (str ~name " seems not be our >> object"))))) >> >> HTH... >> >> Jim >> >> >> > -- > 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+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/**group/clojure?hl=en<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