Reputation: 33029
Currently (Clojure v1.6) you can give a type hint two ways:
^floats xs
#^floats xs
According to Clojure ^floats vs. #^floats?, the latter is legacy syntax, and the former is the current preferred form.
When did that change happen?
Upvotes: 6
Views: 106
Reputation: 33029
^
macro characterIn Clojure v1.0, the ^
character is the "meta reader macro". In other words, ^x
was shorthand for (meta x)
. #^
was used to associate metadata with an object. (See the Macro Characters documentation from November 2009.)
At some point, someone probably realized that having special cases for both #^
and ^
, both related to metadata, was confusing. They decided to deprecate ^
, with the plan to eventually replace #^
with ^
. In Clojure v1.1, the ^
reader macro was officially deprecated. (See the Macro Characters documentation from January 2010.)
There's a commit on April 26, 2010 on Github that replaces the old ^
behavior with the #^
behavior. (This is when #^
and ^
became synonymous.)
In the Clojure v1.2 release, #^
was deprecated in favor of ^
. (See the Macro Characters documentation from August 2010.)
They removed the last few instances of #^
from clojure.core back in 2013, sometime before the Clojure v1.6 release.
Upvotes: 11