I have looked through google and few books but couldn't find documentation about attr-map.
(c/defmacro ^:clojure-special-form throw
"Throw to the catch for TAG and return VALUE from it.
Both TAG and VALUE are evalled."
{:arglists '([TAG VALUE])}
[tag value]
Why is attr-map needed inspite of the params vector? Also can someone point me to a detailed resource about metadata in Clojure.
It's not needed in that case. It's redundant.
user=> (defmacro ^:clojure-special-form throw {:arglists '([TAG VALUE])} [tag value] `(throw (Exception. ~tag ~value)))
#'user/throw
user=> (meta #'throw)
{:macro true, :ns #<Namespace user>, :name throw, :file "NO_SOURCE_PATH", :line 41, :arglists ([TAG VALUE]), :tag :clojure-special-form}
compare with:
user=> (defmacro ^:clojure-special-form throw [tag value] `(throw (Exception. ~tag ~value)))
#'user/throw
user=> (meta #'throw)
{:macro true, :ns #<Namespace user>, :name throw, :file "NO_SOURCE_PATH", :line 43, :arglists ([tag value]), :tag :clojure-special-form}
See this explanation of special forms.
See also: Learning Clojure: Meta Data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With