元数据 reader 语法何时从 #^ 更改为 ^?
When did the metadata reader syntax change from #^ to ^?
目前 (Clojure v1.6) 您可以通过两种方式提供类型提示:
^floats xs
#^floats xs
根据 ,后者是遗留语法,前者是当前的首选形式。
这种变化是什么时候发生的?
^
宏字符的简史
在 Clojure v1.0 中,^
字符是 "meta reader macro"。换句话说,对于 (meta x)
,^x
是 shorthand。 #^
用于将元数据与对象相关联。 (参见Macro Characters documentation from November 2009。)
在某些时候,有人可能意识到 #^
和 ^
的特殊情况都与元数据有关,这令人困惑。 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.)
a commit on April 26, 2010 on Github 将旧的 ^
行为替换为 #^
行为。 (这是 #^
和 ^
成为同义词的时候。)
在 Clojure v1.2 版本中,#^
was deprecated in favor of ^
. (See the Macro Characters documentation from August 2010。)
他们 removed the last few instances of #^
from clojure.core 早在 2013 年,Clojure v1.6 发布之前的某个时候。
目前 (Clojure v1.6) 您可以通过两种方式提供类型提示:
^floats xs
#^floats xs
根据
这种变化是什么时候发生的?
^
宏字符的简史
在 Clojure v1.0 中,
^
字符是 "meta reader macro"。换句话说,对于(meta x)
,^x
是 shorthand。#^
用于将元数据与对象相关联。 (参见Macro Characters documentation from November 2009。)在某些时候,有人可能意识到
#^
和^
的特殊情况都与元数据有关,这令人困惑。 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.)a commit on April 26, 2010 on Github 将旧的
^
行为替换为#^
行为。 (这是#^
和^
成为同义词的时候。)在 Clojure v1.2 版本中,
#^
was deprecated in favor of^
. (See the Macro Characters documentation from August 2010。)他们 removed the last few instances of
#^
from clojure.core 早在 2013 年,Clojure v1.6 发布之前的某个时候。