【发布时间】:2014-11-21 04:18:22
【问题描述】:
我在向编写宏的代码添加警告时发现,文件主体在编译期间被执行了两次。是否有一个原因?这是 leiningen 特有的吗?我无法使用(compile ...) 重现此内容。
简化版:
(ns foo.core
(:require foo.bar))
;; empty
(ns foo.bar)
(println "hello")
$ lein 编译:全部
编译 foo.core
hello编译 foo.bar
hello
进一步的测试表明,命名空间在编译期间被重新加载到自身之上:
(ns foo.bar)
(declare wasd)
(println wasd)
(def wasd 2)
$ lein clean
$ lein 编译:全部
编译 foo.core
#<Unbound Unbound: #'foo.bar/wasd>编译 foo.bar
2
在更复杂的情况下,我在编译期间发生了这种情况,然后每次从 lein 运行或启动 repl 时都会发生一次。我不确定为什么。这是 clojure 1.6 和 leiningen 2.5.0 的全部内容。
【问题讨论】:
标签: clojure compilation leiningen