On Fri, Jan 16, 2009 at 12:22 PM, Greg Harman <ghar...@gmail.com> wrote: > >> > 2. If I want the Clojure functions that underlie the methods in the >> > generated class used directly by my Clojure code as well (which I do), >> > then I'm stuck having to either violate standard Clojure/Lisp function >> > naming conventions in favor of Java-friendly naming or I have to write >> > wrapper functions like: >> >> > (defn myMethod [obj] (my-method obj)) >> >> > Other than using the prefix and keeping the method names to one >> > "word", is there a better way? >> >> Since gen-class is used to create Java classes, it's sensible that the >> naming convention within the generated class be Java's. > > I agree that the convention inside the generated class should be a > Java convention (my original post was more of an experiment than an > attempt to create a working class with that signature). However, I > find myself wanting to write a clojure function that can be exposed to > both Clojure and Java code, and I'd like to keep them in their > respective paradigms. That is, in Clojure, I don't want to have to > call (.myMethod foo) when I already have (my-method) defined. And in > Java, I want to just use foo.myMethod(), not have to wrap up a call to > RT.var().invoke(). > > I know I'm being picky, but it just seems cleaner this way...
write a macro that takes all fns in the current namespace and generates wrappers with the correct naming style. problem solved. -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---