I've defined a java class using gen-class
and it get compile everytime I start the repl. However, if I wish to make changes to the class, I find that I have to restart and recompile the class. Is there anyway to do this without closing down the repl?
I am working on this https://github.com/zcaudate/hara/blob/master/src/hara/ova/impl.clj
and there is a line in project. clj
:aot [hara.ova.impl]
So say the file is already loaded and I can do:
(import hara.ova.Ova)
(def a (Ova.))
I wanted to add another method bar
to the class, I just wish to define -bar
in the hara.ova.impl
namespace, call a compile-gen-class
function to reload the class and then do
this without reloading the repl:
(import hara.ova.Ova)
(def a (Ova.))
(.bar a)
right now, C-c C-k doesn't allow that.
You need to call the compile
function on the namespace.
(ns test)
(gen-class :name test.Cls)
(comment (compile 'test))
The call to compile needs to be commented out so it won't recursively call itself. I often leave these in my development files to quickly recompile definitions by evaluating that compile expression.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With