Hi all,
I want to compose a java function call out of a string in a macro:
I tried something like this simplified example, but it doesn't work.
creating a symbol out of a string is not enough.
Note: I know that uppercase variable names are bad, but it simplifies the
example.
So how I do it right?
TIA Steffen
repl:
user> (defmacro set-example [obj feature]
(let [meth-name# (symbol (str ".set" (name feature)))]
`(~meth-name# ~obj ~feature)))
#'user/set-example
user> (let [o (javax.swing.JCheckBox . "foo")
Label "xxx"]
(set-example o Label))
CompilerException java.lang.RuntimeException: Unable to resolve symbol: .
in this context, compiling:(/tmp/form-init6247570319423795481.clj:1:9)
--
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.