force clojure :reload

隐身守侯 提交于 2019-12-08 07:51:17

问题


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


回答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.



来源:https://stackoverflow.com/questions/3902545/force-clojure-reload

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!