The with-meta in (fn ^:static with-meta ...) is just the name the
function created by the fn form will know itself by. It will also be
used as the final segment of the name of the class of this function
object. It's not being evaluated in this position, and in fact it
could be replaced with, say, foo (and then you'd get mentions of a
class with name ending with "foo" in stack traces caused by improper
uses of with-meta). On the other hand, the fact that the function has
a name means that it could call itself through this name, return
itself as a value etc.; effectively giving a function a name creates a
local holding the function itself within the function body.

Cheers,
Michał

On 21 September 2013 11:36,  <ljcppu...@gmail.com> wrote:
>  You are right, i noticed  "it calls withMeta", but  in the expression,
> actually use with-meta to define with-meta, it's very strange, thank you
> very much!
>     (def with-meta (fn ^:static with-meta [^clojure.lang.IObj x m]
>               (. x (withMeta m))))
>
>
> On Saturday, September 21, 2013 3:30:30 PM UTC+8, Michał Marczyk wrote:
>>
>> Actually with-meta's definition does not refer to with-meta. Rather,
>> it calls withMeta, a method in the clojure.lang.IObj interface which
>> the first argument to with-meta is supposed to implement.
>>
>> Cheers,
>> Michał
>>
>>
>> On 21 September 2013 09:01,  <ljcp...@gmail.com> wrote:
>> > Hi,
>> >   I read the source about with-meta, and find def with-meta using
>> > with-meta,
>> > can it?  someone give a explain?
>> >
>> > user=> (source with-meta)
>> > (def
>> >  ^{:arglists '([^clojure.lang.IObj obj m])
>> >    :doc "Returns an object of the same type and value as obj, with
>> >     map m as its metadata."
>> >    :added "1.0"
>> >    :static true}
>> >  with-meta (fn ^:static with-meta [^clojure.lang.IObj x m]
>> >              (. x (withMeta m))))
>> >
>> > --
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to clo...@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+u...@googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/group/clojure?hl=en
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Clojure" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to clojure+u...@googlegroups.com.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to