http://clojure.org/metadata says "Symbols and collections support metadata"
So I try to set metadata to a symbol:
=> a
17
=> (def aa ^a 'x)
=> aa
x
=> (meta aa)
nil
It does not work as I expected.
=> (def aa ^a [])
=> (meta aa)
{:tag 17}
This does.
Is this a mistake in the documentation? If not, can you please explain?
Update after answer by Arthur Ulfeldt: So I understand it as follows. When I wrote
(def aa ^a 'x)
the reader expanded it into
(def aa ^a (quote x))
so the metadata were at the list (quote x), and not at the symbol. When evaluating the def macro, this list got evaluated, leaving us with x, and the metadata were lost.