Is it documented anywhere that primitive type tags on Vars cannot use abbreviated form?

53 views
Skip to first unread message

Andy Fingerhut

unread,
Nov 10, 2014, 3:44:04 PM11/10/14
to cloju...@googlegroups.com
If one tries to type hint a Var in Clojure/JVM like this:

(def ^long foo 1)

then the metadata associated with foo is actually {:tag x} where x is the function clojure.core/long.  Such a type hint causes no errors or warnings from Clojure, but it also does not help in avoiding reflection during Java interop.  A type hint that does help avoid reflection is:

(def ^{:tag 'long} foo 1)

I did not find any examples like this or mention of it on this page: http://clojure.org/java_interop

Is it documented elsewhere, perhaps?

Thanks,
Andy
Reply all
Reply to author
Forward
0 new messages