强制clojure:重装 [英] force clojure :reload

查看:135
本文介绍了强制clojure:重装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,如果没有修改.clj文件,(使用'somemodule:reload)不会重新加载模块。



但是我有一个用于强制重新加载模块的用户程序,即使文件没有改变。我为clojure创建了一个haml宏,它读取一个外部文件并生成clojure代码。



http://www.coldcode.net/2010/10/haml-macro-for-clojure.html



我希望能够重新加载clojure模块,而不管文件的时间戳。



有人知道是否可能? (我想避免从编辑器外面触摸文件)



编辑:我使用clojure 1.2,leiningen 1.3.1

将强制重新加载模块

$ b
$ b

但是它听起来好像你使用AOT编译和clojure度假AOT编译的.class文件而不是源。如果你不需要AOT编译(在99%的情况下读取: gen-class ,其余的主机vm上没有动态字节代码gen)用它。如果你真的需要 AOT编译,我只能想到删除命名空间的.class文件。


I noticed that (use 'somemodule :reload) doesn't reload the module if the .clj file was not modified.

However I have an usecase for forcing the reload of the module even if the file isn't changed. I created a haml macro for clojure which reads an external file and generates clojure code.

( http://www.coldcode.net/2010/10/haml-macro-for-clojure.html )

I would like thus to be able to reload the clojure module regardless of the file timestamp.

Does anybody know if it's possible? (I would like to avoid touching the file from outside of my editor)

EDIT: I use clojure 1.2, leiningen 1.3.1

解决方案

:reload will force reloading of the module.

But it sounds as if you use AOT compilation and clojure resorts to the AOT compiled .class files instead of the source. If you don't need AOT compilation (read: gen-class in 99% of the cases, no dynamic byte code gen on the host vm in the rest) don't use it. If you really need AOT compilation, I can only think of removing the .class files for the namespace.

这篇关于强制clojure:重装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆