On 18 Jun, 2011, at 1:12 , Michael Gardner wrote:

> On Jun 17, 2011, at 3:44 AM, Konrad Hinsen wrote:
> 
>> Java methods aren't even first-class objects (nor, in fact, objects at all) 
>> in the Java world. Clojure can hardly do better than Java in unifying things 
>> at the JVM level. The one thing that you can do with a method in Java is 
>> call it, and the same limitation applies in Clojure.
> 
> Why would it have to be done at the JVM level? Couldn't the Clojure compiler 
> generate an anonymous function whenever it sees a Java method? I presume it 
> currently doesn't do this for performance reasons.

How would it "see" a Java method in the first place? It's not a value, so 
Clojure would have to add a special language rule for making sense of it: "a 
symbol that does not refer to a var but that does name an existing Java method 
is replaced by an anonymous function calling that Java method". I doubt the 
benefit (syntactic sugar) would justify the added complexity. The explicit 
creation of the anonymous function by the programmer also takes care of the 
arity problem; an automatically generated one would have to cover all possible 
arities.

Konrad.

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