On Tue, Sep 1, 2009 at 1:36 PM, John Harrop<jharrop...@gmail.com> wrote:
> On Tue, Sep 1, 2009 at 10:40 AM, Rich Hickey <richhic...@gmail.com> wrote:
>>
>> On Mon, Aug 31, 2009 at 10:55 AM, Krukow<karl.kru...@gmail.com> wrote:
>> >
>> >
>> > user> (macroexpand ' (.getResourceAsStream java.lang.String s))
>> > (. (clojure.core/identity java.lang.String) getResourceAsStream s)
>> > user>
>>
>>
>>
>> #1 is fine idea. I've implemented the hinting in the compiler where
>> that expansion takes place. (commit  e45046da8f)
>
> Why is there a call to identity at all? Why not just
> (. java.lang.String getResourceAsStream s)?

That form means the same as (java.lang.String/getResourceAsStream s)

user=> (macroexpand '(java.lang.String/getResourceAsStream s))
(. java.lang.String getResourceAsStream s)

That is, a static method getResourceAsStrram of class
String.  There is no such method because you actually want
the instance method of class Call, so you'd get an error.
This (or more often its inverse) used to be Clojure FAQ #1
until the (.foo bar) vs. (Foo/bar) interop forms were fully
implemented.  You should be glad you only run into it now
when poking around in macroexpanded internals!  :-)

--Chouser

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