Looks good so far, Rich.  Should be a blissfully smooth transition
from the "legacy" gen-class impl.

This is only tangentially related to the docs you're writing, but I
won't let that stop me:

As you know, I have at least one use case where being able to generate
gen-class specs from a macro (or, the full ns declaration, in the
absence of an evaluated gen-class spec).  Going one step further than
that though, I'm wondering how best to approach contexts where one
would like to generate classes whose names don't match up with the
name of the current file (or with the package the generated class will
land from the current file).  Right off the top of my head, easily and
cleanly generating BeanInfo classes based on attributes/methods/
interfaces/whatever of the current file's class would be super-handy.

This doesn't look possible right now -- adding a second, different ns
declaration does not generate the corresponding classfiles.  The docs
you've written so far make it sound like this should work -- "The unit
of compilation is the namespace" -- but right now, it seems like files
are the unit of compilation.  Just as an example, assume the following
is in com/foo/test.clj:

(ns com.foo.test
    (:gen-class
     :implements [java.util.Iterator]
     :init ctor
     :constructors {[String] []}
     :state state))

(ns com.foo.test2
    (:gen-class
     :implements [java.util.Iterator]
     :init ctor
     :constructors {[String] []}
     :state state))
---------

(compile 'com.foo.test) yields the com.foo.test classfiles one would
expect.  However, (compile 'com.foo.test2) throws an exception, as
it's looking for a com/foo/test2.clj file (rather than using whatever
has already been defined in the com.foo.test2 namespace).  I see why
that's the case, as compilation and loading are very tightly bound.
If that's going to remain the case, then I'd say that clj files are
the unit of compilation, not namespaces.  It's not yet clear (to me,
anyway) whether the current state is an intermediate stable step, or
if the first cut on the docs are slightly off on this point.

- Chas

On Nov 26, 7:09 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
> I've started documenting AOT compilation and the new :gen-class option
> for ns:
>
> http://clojure.org/compilation
>
> It's still a work in progress. Feedback welcome.
>
> Rich
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to