I was playing with built-in specs and discovered there are A LOT of places to embed var metadata in defn:
(defn ^{:b 1} foo
{:c 1}
([])
{:a 1})
:a
, :b
and :c
all end up in var meta!I wonder how's that, and why :arity-n
defn variation allows attr map at the end...
> I wonder how's that I guess it's because if there was just one place, people could accidentally place it elsewhere and get no metadata attached
I found that when I spec’ed it and asked Rich about it. The thought at the time was that metadata might get big (this predated some of the ^ syntax) and it would obscure the main part of the function so you could put it at the end
It’s rarely used but I did find some places using when testing a spec without it
Very interesting, thanks for this explanation!