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?
Syntax. Metadata (metacontent) syntax refers to the rules created to structure the fields or elements of metadata (metacontent). A single metadata scheme may be expressed in a number of different markup or programming languages, each of which requires a different syntax.
The first recorded use of metadata dates to the Great Library of Alexandria in 280 B.C. Check out this infographic that details the entire history of what we now call "metadata".
There are three main types of metadata: descriptive, administrative, and structural.
^
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.
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