here's a boot riddle (does work in leiningen and clj):
(let [t (System/nanoTime)]
(spit "src/foo.clj" (str "(ns foo)\n(def t " t ")"))
;(Thread/sleep 20) delay only required for boot-clj
(require 'foo :reload)
(let [t0 (var-get (resolve 'foo/t))]
(if (= t t0)
:great
(list 'not= t t0))))
I'm expecting :great
, but boot-clj doesn't detect the change without a delay@jeroenvandijk I dont understand the question, is this in a repl?
yeah it is from the repl. But I ran into the issue running require
programmatically
So my question is why is there a delay with boot-clj, but not in the other environments
@jeroenvandijk this is going to depend on your boot task structure, generally you shouldn’t need to do that unless you are spinning up a pod
boot uses a filesystem cache
ah that would explain it 🙂
the file watchers take time to update
but I would say your issue is probably how you are doing the require programmatically
So I'm using another file watcher (hawk) that hooks into mac osx events. I guess that this is faster than the boot watcher
is this for a boot task or just within the repl for exploration purpose?
yeah i'm just using boot as repl now. i'm not using any watch functionality (explicitly)
That could be an improvement point maybe, but I don't want to couple it to boot (yet)
But the delay is ok for now , at least now I know 🙂
Thank you
yeah we could implement a watch task using Hawk if it becomes a sticking point
I guess in this case that could make the issue even more difficult to see as latency would be minimal and it wouldn't happen all the time 🙈
I should get rid of the my custom file watcher then
what is the file watcher for?
i'm trying to implement autotesting at function level
like autotest for midje, but much smarter
It involves a lot of macro magic so I was a bit afraid that the cause was my rewriting code