> If you know the method you wish to call, do you not know the class and can > thus call the static method directly?
Well that was the point of the question, that is if I have to call a static method on a class we don't know in advance. I understand this capability isn't that useful and is quite rarely used, but maybe somebody will one day need it for some practical reason. ;-) > My first impression is that this is probably not the best way to go > about this. Java classes are not like Ruby or Python classes; you > can't just call methods on them. Using "eval" is a hack, and probably > not a good idea. Yeah, you're quite right about this. For now I'm just experimenting with some ideas on how to abstract Java libraries, nio in this case. So it's not something I really need. > If you go this route, I recommend either using or learning from the > functions in clojure/src/jvm/clojure/lang/Reflector.java. Its methods > are not part of Clojure's official interface, so the usual caveats > about using unsupported "implementation private" code apply, but it > include many useful methods for dealing with reflection from Clojure. I'll certainly use the Reflector class, should have thought about it! I wonder if it would be a good idea to include a function for it in Clojure or in Contrib? As for the call-static macro, I now understand the error message. It was quite obvious in fact, as macros must output something that the reader can read! Thanks all! - budu --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---