如何在REPL中重新加载clojure文件 [英] How to reload a clojure file in REPL
本文介绍了如何在REPL中重新加载clojure文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Clojure文件中定义的重载函数的首选方法是什么,而不必重新启动REPL。现在,为了使用更新的文件,我必须:
What is the preferred way of reloading functions defined in a Clojure file without having to restart the REPL. Right now, in order to use the updated file I have to:
- 编辑
src / foo / bar.clj
- 关闭REPL
- 打开REPL
-
(load-filesrc / foo / bar.clj)
-
(使用'foo.bar)
- edit
src/foo/bar.clj
- close the REPL
- open the REPL
(load-file "src/foo/bar.clj")
(use 'foo.bar)
此外,(使用'foo.bar:reload-all)
不会导致需要的效果,这是评估修改的函数体并返回新值,而不是表现为源没有改变。
In addition, (use 'foo.bar :reload-all)
does not result in required effect, which is evaluating the modified bodies of functions and returning new values, instead of behaving as the source haven't changed at all.
推荐答案
或
(使用'your.namespace:reload)
这篇关于如何在REPL中重新加载clojure文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文