That's fair, except that it's a little disappointing that I can't
reference nested structures from Clojure in the natural way, akin to
Java.  In Java, if I had imported NestedStatics, I could reference
NestedStatics.LevelOne without bringing LevelOne into my namespace
(and possibly into conflict with other imports!).  In Clojure,
however, it appears that any class that I want to reference needs to
be fully qualified or explicitly imported into my own namespace.

On Dec 28, 11:09 pm, David Brown <cloj...@davidb.org> wrote:
> On Mon, Dec 28, 2009 at 02:50:59PM -0800, Mark Tomko wrote:
> >This, however, does not work:
>
> >(ns org.tomko.konkordans.analysis
> >  (:import
> >    (org.tomko.konkordans NestedStatics)))
>
> >(def foo NestedStatics$LevelOne$LevelTwo/NO)
>
> The class is called NestedStatics$LevelOne$LevelTwo, so you would have
> to import that if you wanted to use it.  As far as the JVM is
> concerned, NestedStatics, NestedStatics$LevelOne and
> NestedStatics$LevelOne$LevelTwo are just three independent classes.
>
> Java added nested classes, but didn't really add them to the JVM.  It
> just makes longer class names using the '$'.
>
> It's probably safe to rely on this behavior, since there is plenty of
> code that depends upon it working this way.
>
> David

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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