Fork me on GitHub
#interop
<
2023-04-21
>
adamfrey16:04:03

Does it make sense to type hint a Java interface vs. a concrete class? I have clojure code that is going to be passed some sort of Iterable that I don't know ahead of time so I was wondering if I should do:

(let [^Iterable i (:val m)]
    ...
    (.size i))
to avoid reflection on the .size call.

Alex Miller (Clojure team)18:04:40

Although Iterable doesn’t have a size method

adamfrey18:04:12

Thanks. And also, good point.