On Wed, Oct 28, 2009 at 10:15 PM, Alex Osborne <a...@meshy.org> wrote:

>
> Tiago Antão wrote:
> > Again, the point here is to be able to construct method names (full
> > call signatures, really) on runtime.
> >
> > I am lost. As in newbie clueless :(
>
> As others have suggested you need to use either Java's reflection or
> Clojure's eval.


Not quite -- this works as long as the "Bla" part is a constant:

(defmacro setProperty [field obj value]
  (let [cct (symbol (.concat ".set" (str field)))]
    `(~cct ~obj ~value)))

user=> (macroexpand-1 '(setProperty Bla x 1))
(.setBla x 1)

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