Testing the new (ns ... :genclass ...), I copied Rich's example from
http://paste.lisp.org/display/70665:
(ns my.hello
(:gen-class
:extends javax.swing.DefaultCellEditor
:constructors {[Integer] [javax.swing.JCheckBox]}
:factory makeone
:methods [[mymax [int] int]]
:init init
:main true
:state myint
:exposes {clickCountToStart {:get get-c-count :set set-c-count}})
)
(defn- -main [foo]
(println "Hello" foo "World!")
(let [x (my.hello. 42)]
(prn (.mymax x 21))))
(defn- -init [myint]
[[(javax.swing.JCheckBox.)] myint])
(defn- -mymax [this i]
(max i (.myint this)))
(defn- -getCellEditorValue [this]
(prn :getCellEditorValue)
nil)
I can compile and run the example, but it doesn't work with the "/"
syntax for main, even though main is a static method:
user> (.getProperty System "java.class.path")
"/home/kreg/src/clojure/trunk/clojure.jar:/home/kreg/src/junk"
user> (binding [*compile-path* "/home/kreg/src/junk"] (compile
'my.hello))
#{my.hello swank ...}
user> (.main my.hello (into-array ["Bizarro"]))
Hello Bizarro World!
42
nil
user> (my.hello/main (into-array ["Bizarro"]))
java.lang.Exception: No such var: my.hello/main
Works from command line ok:
[EMAIL PROTECTED] ~/src/junk
$ java -cp .:/home/kreg/src/clojure/trunk/clojure.jar my.hello
"Bizarro"
Hello Bizarro World!
42
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---