HI Bill, I also tried the metadata tag and couldn't get it to work, but the following does...
(ns gncls.MyStatic (:gen-class :methods [[say-hi [String] String]])) (defn -say-hi [this who] (str "Hi " who)) (defn -say-static-hi [who] (str "Hi " who)) user=> (compile 'gncls.MyStatic) user=> (.say-hi (gncls.MyStatic.) "Bill") "Hi Bill" user=> (gncls.MyStatic/-say-hi "" "Bill") "Hi Bill" user=> (gncls.MyStatic/-say-static-hi "Bill") "Hi Bill" That is, a static method is automatically created for the "prefixed" method which you can call directly. You could make use of :prefix in :gen-class to tidy this up. I'm not sure if this is the whole story though. Regards, Adrian. On Tue, Mar 10, 2009 at 6:03 AM, .Bill Smith <william.m.sm...@gmail.com> wrote: > > The genclass documentation says, "Static methods can be specified with > #^{:static true} in the signature's metadata." I thought that would > mean this: > > (ns tango.test.unit.StaticTest > (:gen-class > :methods [[f [] #^{:static true} void ]])) > > (defn -init [_] ()) > > (defn -f [] (println "hello world!")) > > But that doesn't seem to do the trick: > > ~/projects/junit-clojure$ javap -classpath /home/bsmith/software/ > clojure/trunk/clojure.jar:/home/bsmith/software/junit-4.4/ > junit-4.4.jar:$PWD:$PWD/classes tango.test.unit.StaticTest > public class tango.test.unit.StaticTest extends java.lang.Object{ > public static {}; > public tango.test.unit.StaticTest(); > public java.lang.String toString(); > public boolean equals(java.lang.Object); > public java.lang.Object clone(); > public int hashCode(); > public void f(); > public static void main(java.lang.String[]); > } > > I'm using Clojure rev 1327. > > Bill Smith > Austin, Texas > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---