Hi Herwig,
On Thursday, 7 May 2015 15:36:44 UTC+1, Herwig Hochleitner wrote:
>
> 2015-05-07 16:12 GMT+02:00 Stig Brautaset <[email protected]
> <javascript:>>:
>
>> Is it because the def form can also be ^:dynamic?
>>
> Hm, cognitect turned it down, because basically "if you go down this road,
> why stop with def- ? and before you know, you've got a core namespace full
> of def*-"
>
And that is a fine justification :-) I was just curious.
> Can you not attach metadata in a macro?
>>
> You can, but it works differently than in normal source. Remember, that ^
> attaches metadata the literal, that you annotate. so ^:private ~sym is the
> symbol ~sym with a private metadata key. The quasiquoting, however,
> rebuilds the form and inserts the sym parameter in place of the ~sym form.
> So to attach the metadata to actual def'ed symbol, you need to attach it to
> the output, the macro generates, like this: `(def ~(with-meta sym {:private
> true}) ...)
>
Thank you for this explanation, it makes sense now!
Stig
--
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
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.