元数据读取器语法何时从#^更改为^? [英] When did the metadata reader syntax change from #^ to ^?
问题描述
目前(Clojure v1.6)你可以用两种方式给出类型提示:
^ float xs
#^ floats xs
根据 Clojure ^ floats vs.#^ floats? ,后者是传统语法,前者是当前的首选形式。
^
宏字符的简要历史
-
在Clojure v1.0中,
^ ,都与元数据相关,令人困惑。 他们决定弃用^
元读取器宏。换句话说,^ x
是(meta x)
的缩写。#^
用于将元数据与对象相关联。 (请参见2009年11月宏字符文档。)^
,计划最终用^
替换#^
。在Clojure v1.1中,^
阅读器宏已正式弃用。 (请参阅2010年1月起的宏字符文档。) -
2010年4月26日,在Github上提交了提交将
^
行为替换为#^
行为。 (这是#^
和^
成为同义词。) -
在Clojure v1.2版本中,
#^
已弃用,赞成^
。 (请参阅2010年8月起的宏字符文档 a>。) -
他们删除了最后一个
$ b $ b
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?
A brief history of the ^
macro character
In 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.
这篇关于元数据读取器语法何时从#^更改为^?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!