Hi,

Consider following code:

(defprotocol WithOptions
             (getOptions [this] "All options")
             (getOption [this option] "One option"))


(defn- gen-proxy [klass opts]
       `(proxy [~klass WithOptions] []
               (getOptions [~'_] ~opts)
               (getOption [~'this x#] ((getOptions ~'this) x#))))


The gen-proxy functions is a helper which is used in macros. The code
works, as far as I can tell, but there's one thing that intrigues me:
the usage of unquote/quote is necessary (~'_ and ~'this). I assume it
has something to do with macros qualifying symbols with the current
namespace. I am yet to fully understand the mechanism here, but my
question for the moment is whether this kind of construct is idiomatic
in clojure. Or is there another way to introduce symbols in macros?

Thanks,
Razvan

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