On Oct 12, 2011, at 3:49 PM, Armando Blancas wrote:
>> The metadata tells you why:
>>
>> user=> (meta #'*dynamo*)
>> {:ns #<Namespace user>, :name *dynamo*, :dynamic true, :line 1, :file
>> ...}
>
> The var tells you why:
> user=> (.isDynamic (var *dynamo*))
> true
The mere human who has not read Var.java is not going to know about its methods
(or are they a documented part of the interface?) The debugging-person
presented with a variable that's not behaving dynamically might well look at
the metadata to see what's up.
>
> user=> (.isDynamic (var *copy*))
> false
> user=> (.setDynamic (var *copy*))
> #'user/*copy*
> user=> (binding [*copy* "new value"] *copy*)
> "new value"
Can you think of a reason why a person might use the `(intern *ns* (with-meta
symbol))` idiom and *not* want isDynamic-ness to be copied?
Seems to me that if you're going to use metadata to communicate intention about
dynamic binding in *one* way of creating a new var, you should do it with *all*
ways of creating a new var.
-----
Brian Marick, Artisanal Labrador
Now working at http://path11.com
Contract programming in Ruby and Clojure
Occasional consulting on Agile
--
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