Hi,
After I got your help last week to get my Macro working :) I tried to
expand it more:
I'm trying to parameterizing my object creation (I'm using
clojure.core.match). Source class offers multiple constructors:
(defmacro source [source-name constructor-args & meths]
(match [constructor-args]
[{}]
`(def ~source-name (proxy [Source]
[]
~@(for [meth meths]
(let [[method-name args & body] meth
camel-case-method-name (hyphenated->camel-case method-name)]
`(~camel-case-method-name ~args ~@body)))))
[{:method _ :resource _}]
(let [^Method meth (:method constructor-args)
^Reference reference (:resource constructor-args)]
`(def ~source-name (proxy [Source]
[^Method meth ^Reference reference]
~@(for [meth meths]
(let [[method-name args & body] meth
camel-case-method-name (hyphenated->camel-case
method-name)]
`(~camel-case-method-name ~args ~@body))))))))
But when macroexpand, I notice the called proxy is the one with the empty
constructor, not the one that takes two parameters.
Am I missing something?
Thanks for help and time.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.