2012/9/24 Frank Siebenlist <frank.siebenl...@gmail.com>

> Guess the AOT compiler uses it but the REPL-one doesn't (???).
>

The reason for this is two-fold:

1) Vars in Clojure are not suffering from that issue, since they are
reified. That means, that their field in the java class is a generated name
and they are interned by their string name. So a def works one way or the
other.

2) With the defn, the *function* classes are named after their namespace
var. So (type foo-bar) => core$foo_bar. When evaluating a defn from the
repl, the fn class is emitted, loaded into the class loader and an instance
of it is assigned to the var. When aot compiling, however, the fn classes
are written as .class files and instantiated (and assigned to their vars)
in the namespace constructor.

When you aot compile my example and look at the classes with jd, you see
that there is just one fn class file core$foo_bar.class. That means that
the former one got overwritten.

In core__init.class you see that two vars are created with their correct
names, but both are assigned an instance of the same class.

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