On Apr 27, 10:04 pm, Boris Mizhen <
bo...@boriska.com> wrote:
> Thanks to all who replied.
>
> To summarize what I learned - Clojure has a special form (. ) to
> *call* java functions, but does not have concept of a *value*
> corresponding to a java function.
> This makes Java functions a second class citizen :)
>
Java was born a second-class citizen, Clojure doesn't make it so. In
particular, Java doesn't have proper functions, it has methods. They
are not first class values in Java, and Clojure can't fix that. You
can't pass Java methods by value and you can't apply them. While it
would be possible to automatically generate wrapper fns for Java
methods that would let you *pretend* they were functions, Clojure
currently doesn't do that, since doing so would often mean silently
generating code that uses reflection, and by the time you add
sufficient syntax to allow type hints, there's little benefit over #
().
> In addition special forms are expanded in the first position of the
> list, but not on other positions, thus in (foo Math/abs) Math/abs is
> no longer a syntax for a static method, but a lookup of a var 'abs' in
> a namespace Math.
>
> Correct?
>
What's correct is what is documented here:
http://clojure.org/java_interop
Rich