2011/4/15 Jules <jules.gosn...@gmail.com>:
> I've reduced a compile-time reflection warning that I am getting to the
> following :
>
> put this in a file and compile it (I am using clojure-1.3.0alpha5 and
> clojure-maven-plugin-1.3.7) :
>
> (ns org.dada.demo.mytest)
>
> (if true
>   (do
>     (def ^java.util.Collection some-numbers [0 23 45 64 67 78])
>     (def ^java.util.NavigableSet numbers (java.util.TreeSet. some-numbers))
>     ))
>
> upon compilation I see :
>
> Reflection warning, org/dada/demo/mytest.clj:6 - call to java.util.TreeSet
> ctor can't be resolved.
>
> but if I strip off the surrounding 'if' e.g. :
>
> (ns org.dada.demo.mytest)
>
>  (do
>    (def ^java.util.Collection some-numbers [0 23 45 64 67 78])
>    (def ^java.util.NavigableSet numbers (java.util.TreeSet. some-numbers))
>    )

In the former, the if top level form (and all its content) is compiled
and evaluated at the same time.

In the latter, the top level do is exploded as as many top level forms
as it contains, so the first def is compiled and evaluated, and then
the second def is compiled and evaluated.

So a difference may lie there, between the time were the type hint on
some-numbers is made available to the special form (java.util.TreeSet.
) ...

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