Actually `set` and a lot of other clojure.core functions are neither
inlineable nor have type hints.

Phillip Lord writes:

> I have a piece of code that looks like this
>
> (.getOWLEquivalentClassesAxiom
>       (owl-data-factory)
>       (set classlist)
>       (union-annotations classlist))
>
> The method signature is
>
> getOWLEquivalentClassesAxiom(Set,Set)
>
> On runing lein check I get
>
>
> Reflection warning, tawny/owl.clj:2219:6 - call to method
> getOWLEquivalentClassesAxiom on
> org.semanticweb.owlapi.model.OWLDataFactory can't be resolved (argument
> types: unknown, java.util.Set).
>
> which makes no sense. Surely, the return type of clojure.core/set is
> known to be java.util.Set? I have quite a few calls like this in my
> code, which is why I don't want to type hint the return of set
> individually.
>
> If I add a function like so:
>
> (defn ^java.util.Set hset [coll]
>   (set coll))
>
> and call like this:
>
> (.getOWLEquivalentClassesAxiom
>       (owl-data-factory)
>       (hset classlist)
>       (union-annotations classlist))
>
> The reflection warning goes away.
>
>
> I've tried to reproduce this with simpler cases, like so:
>
>
> (defn one []
>   (java.util.Collections/unmodifiableSet
>    (java.util.HashSet.)))
>
>
> (defn two []
>   (java.util.Collections/unmodifiableSet
>    (set [])))
>
> But both of these pass lein check just fine. Which suggests that clojure
> knows set returns a java.util.Set object.
>
> Now, given that I can't give a simple test case, I realise that it's
> hard for anyone to work out what is happening. But, worse, I don't know
> how to debug this at all. So, how I find out what clojure things the
> return type of a function is? Or probe any further why this is failing?
>
> Phil

--

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to