#clojure logs

2008-05-03

10:08cmiles74This may be kind of a dopey question, but I can't figure it out... If I have string that has the name of a function in it, is there a quick way to get at that function? I'm trying parse things the user types in.
10:09rhickey'read' is one way to avoid strings altogether
10:09rhickeyand preferred if the input is Clojure code
10:10rhickeyelse something like:
10:10rhickeyuser=> (resolve (symbol "list"))
10:10rhickey#'clojure/list
10:12cmiles74Yep, that is what I was trying to do! Your other point is well taken, I have to think about if this is really the way I want to do it.
10:12cmiles74Thank you.
15:43rhickey_gen-class is up!, everything I talked about yesterday, plus auto-load .clj from classpath
15:43rhickey_put the .clj next to the .class file
16:04baggleshum
16:04bagglesw3ait
16:04bagglesdoes this mean there's a clojure ... without needing createclassloader
16:04bagglesor whatever it was that was preventing applets from working?
16:05rhickey_no, Clojure compiles on the fly and needs its own classloader
16:06rhickey_this let's you create statically-named Java classes that end up calling Clojure code, greatly easing integration into Java frameworks like servlets, Netbeans/Eclipse etc
16:07rhickey_also mor epowere when deriving from Java classes - access to protected members, adding methods, setting up custom constructors and static factory methods, support for main etc
16:08rhickey_plus final state, which can be a ref or agent, allowing for transactional or asynch Java objects
17:26Chouserwell gen-class allow access to superclass methods?
17:29rhickey_kind of - the recipe is, in some method foo in which you want to call super.foo, just bind foo to nil and call this.foo
17:34Chouser(gen-class ... :methods foo [void []] ...) ... (def foo nil) ?
17:35Chouserand then calls to foo will actually call super's foo?
17:35rhickey_you never need to use methods unless you are adding new methods, not needed for overrides or implementing interface methods
17:35rhickey_all of the superclass/interfaces methods will be public in your class
17:36rhickey_so the only uncovered case is when you are overriding foo and need to call the superclass
17:37rhickey_(defn foo [] (binding [foo nil] (.foo this)) ...)
17:37Chouserok, makes sense. that's actually the case I have.
17:37Chouseroh!
17:37Chouserhehe, I see.
17:37rhickey_temporarily unbinding foo causes the default behavior of calling the superclass version
17:38Chouseryep, ok, thanks.
20:18blbrowndoes anyone have a clojure test framework out there?