作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
今天我发现了一些奇怪的事情。当我不在项目“中”时(即 shell 不在 clojure 项目目录中),我可以使用 exit
退出 REPL:
shell$ lein repl
REPL started; server listening on localhost port 43712
user=> (+ 3 4)
7
user=> (exit)
shell$ echo '<span>not in <s>kansas</s>clojure anymore</span>'
当我“在”一个项目中(即 shell 位于 clojure 项目的目录中)时,我无法使用exit
:
shell$ cd my_clojure_project
shell$ lein repl
REPL started; server listening on localhost port 69237
user=> (* 8 4)
32
user=> (exit)
java.lang.Exception: Unable to resolve symbol: exit in this context (NO_SOURCE_FILE:2)
user=>
这里有什么问题?
<小时/>Clojure 版本(对于两个示例):
user=> (clojure-version)
"1.2.1"
Leiningen 版本(对于两个示例):
shell$ lein -v
Leiningen 1.6.1 on Java 1.6.0_26 Java HotSpot(TM) 64-Bit Server VM
最佳答案
这似乎是因为存在项目时 leiningen.core
命名空间不可用。更具体地说,当有一个项目时,你的项目的代码是 evaluated in a separate ClassLoader类路径上只有您的项目。因此,Leiningen 的所有功能均不可用。
Leiningen 2 REPL 没有这个问题。
关于clojure - 为什么 `(exit)` 在 REPL 中并不总是可用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10232760/
我是一名优秀的程序员,十分优秀!