My conjecture would be that the Var gets constructed and assigned its
name in the current namespace first, then the function is constructed,
then metadata gets attached to the Var. Thus the first defn pulls
metadata to be attached to the newly constructed function from a newly
constructed Var, whereas the second defn re-uses the Var which was in
place earlier...
This would appear to support the above:
user> (def #^{:foo "bar"} x 5)
#'user/x
user> (meta #'x)
{:ns #<Namespace user>, :name x, :file "NO_SOURCE_FILE", :line 1, :foo "bar"}
user> (defn x [] 5)
#'user/x
user> (x)
5
user> (meta x)
{:ns #<Namespace user>, :name x, :file "NO_SOURCE_FILE", :line 1, :foo "bar"}
Sincerely,
Michał
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en