今天早上我正在浏览clojure源代码,靠近顶部clojure/core.clj我发现了这个:
(def
^{:arglists '([& items])
:doc "Creates a new list containing the items."
:added "1.0"}
list (. clojure.lang.PersistentList creator))
Run Code Online (Sandbox Code Playgroud)
对我来说看起来很奇怪的是符号creator.它不会出现在它上面的文件中的任何位置.为什么这不是问题?
点特殊形式用于java互操作.既然clojure.lang.PersistentList是一个班级名称符号,
(. clojure.lang.PersistentList creator)
Run Code Online (Sandbox Code Playgroud)
是静态creator字段的访问权限.
https://github.com/clojure/clojure/blob/clojure-1.8.0/src/jvm/clojure/lang/PersistentList.java#L66