On 24.02.2010, at 14:43, Sean Devlin wrote: > How does the reader know the difference between .hashCode > and .reallyObsureMethod? It would need to keep a whitelist of > everything in object, and know that these methods can be called > directly. Maybe the reader should be upgraded to handle this?
It's not the reader who deals with method lookup, it's the compiler. It doesn't need any whitelist for that. If the compiler knows the (Java) type of a data item, it can look up the available methods statically, i.e. at compile time, and generate a direct method invocation is the lookup succeeds. This works in fact very well, it's the basis of using hints for avoiding reflection. What I am surprised about is that in the absence of any hints, the compiler assumes to know nothing about a value's type, whereas I believe it could safely assume that it is a subclass of java.lang.Object, considering that only primitive types are not subclasses of java.lang.Object, but function arguments cannot be primitive types. But I am not enough of a JVM expert to be sure. 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