When trying your code, I encounter the same problem ...

... but what is the compiler error telling us ?

[clojure.lang.AFn] is not a class ?

... maybe clojure.lang.AFn is !

Let's try

(gen-class
 :name xg.gf.GenericFunction
 :extends clojure.lang.AFn
 )

(get rid of the square brackets !)

It's sometimes weird how we just want to see what we want to see ! It took
me almost 10 minutes to find what was just in front of me ! :-)

-- 
Laurent

2009/2/19 mikel <mev...@mac.com>

>
> So I'm looking at improving the implementation of generic functions,
> preparatory to making the library more generally available. One thing
> I ought to do, I think, is make a Java class, GenericFunction, a
> sibling to MultFn. GenericFunction's role is basically the same as
> MultiFn's, it just has a different approach to dispatch.
>
> Now, of course I could write GenericFunction in Java, just as MultiFn
> is written in Java, but I thought it would be nice to use Clojure's
> Java interop features to do it. I haven't tried using gen-class
> before, though, and things are going a bit haywire. Maybe someone can
> point out where I've gone wrong. Some code and other diagnostic info
> is below. Let me know what else I need to provide.
>
> (ns xg.gf)
>
> (gen-class
>  :name xg.gf.GenericFunction
>  :extends [clojure.lang.AFn]
>  )
>
> user> (compile 'xg.gf)
>
> java.lang.ClassNotFoundException: [clojure/lang/AFn] (gf.clj:7)
>  [Thrown class clojure.lang.Compiler$CompilerException]
>
>
> user> (. System (getProperty "java.class.path"))
>
> "/usr/local/clojure/trunk/clojure.jar:/usr/local/clojure/clojure-
> contrib/trunk/clojure-contrib.jar:...:/Users/mikel/Valise/guild/trunk/
> software/clojure"
>
> caeneshluura:clojure mikel$ pwd
> /Users/mikel/Valise/guild/trunk/software/clojure
>
> caeneshluura:clojure mikel$ ls
> ./              xg/
> ../             classes/
>
> /Users/mikel/Valise/guild/trunk/software/clojure/xg/gf.clj
> /Users/mikel/Valise/guild/trunk/software/clojure/classes/xg/gf/
>
>
> >
>


-- 
Cordialement,

Laurent PETIT

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to