On Mon, Mar 9, 2009 at 9:52 PM, .Bill Smith wrote:
>
> Would someone mind showing me a brief example of how to define a
> static method (using gen-class)?
Look for "static" under
http://www.ociweb.com/mark/clojure/article.html#Compiling.
--
R. Mark Volkmann
Object Computing, Inc.
--~--~--
That worked. Thank you for your help, Christophe.
Bill Smith,
Austin, TX
--~--~-~--~~~---~--~~
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
Adrian Cuthbertson a écrit :
> Hi Christophe,
>
> It works as per your example, but not with arguments to the method...
>
> ns gncls.MyStatic
> (:gen-class
> :methods [#^{:static true} [f [String] void ]]))
>
> (defn -f
> [s] ; also [this s] doesn't work
> (prn "Hi from " s ))
>
> (gncl
Hi Christophe,
It works as per your example, but not with arguments to the method...
ns gncls.MyStatic
(:gen-class
:methods [#^{:static true} [f [String] void ]]))
(defn -f
[s] ; also [this s] doesn't work
(prn "Hi from " s ))
(gncls.MyStatic/f "me")
java.lang.Exception: No such var
.Bill Smith a écrit :
> 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 ]]))
>
>
Try:
(n
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.MySta
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 w
Would someone mind showing me a brief example of how to define a
static method (using gen-class)?
Thanks,
Bill Smith
Austin, TX
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group