On Sep 1, 7:36 pm, John Harrop <jharrop...@gmail.com> wrote:
> Why is there a call to identity at all? Why not just (. java.lang.String
> getResourceAsStream s)?
If I understand correctly this is because there is only one special
form for Java access called "dot", written: .
At http://clojure.org/java_interop it is defined:
"If the first operand is a symbol that resolves to a class name, the
access is considered to be to a static member of the named class. Note
that nested classes are named EnclosingClass$NestedClass, per the JVM
spec. Otherwise it is presumed to be an instance member and the first
argument is evaluated to produce the target object."
In our case, we are not looking for a static-access, but a call to a
method defined on the class object. I.e., the former is
(. Classname-symbol member-symbol)
where as we want
(. instance-expr member-symbol)
The slightly hackish solution is to replace the classname-symbol with
an expression which evaluates to the class object, yielding the (.
instance-expr member-symbol) semantics.
Please correct me if I am wrong.
/Karl
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---