Hi, Am 25.12.2011 um 13:03 schrieb Razvan Rotaru:
> I'm not sure I understand your question. The class is known, but it's > transfered as an instance of java.lang.Class. > I also don't quite understand your argument. Clojure creates classes > dynamically (e.g. deftype), so why not create a proxy dynamically? But deftype is a macro. It creates the bytecode required for the new type when the deftype form is run by the compiler. A function is different: it is run at the runtime of the program. Also deftype would not get the class as Class. When you for example implement an interface in your deftype, it does not get that interface as Class, but as Symbol. user=> (defn my-fn [x] (class x)) #'user/my-fn user=> (my-fn String) java.lang.Class user=> (defmacro my-macro [x] (class x)) #'user/my-macro user=> (my-macro String) clojure.lang.Symbol That's why you can't do this. (defn with-dynamic-macro-call [klass] (my-macro klass)) (with-dynamic-macro-call String) (my-macro (class "")) The macro will see the symbol “klass” and not its “contents” – the class String. In the second example it's similar: the macro sees the list containing the symbol “class” and the empty string. Not the result of the function call. Does that clarify things a little? Sincerely Meikel -- 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