Share your thoughts in the 2020 Clojure Community Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
in tools.namespace by
edited by

I'm trying to figure out if I can use tools.namespace.track for a project but I don't understand the :unload :load functionality.

(require '[ :as ns-track])

;; define a empty tracker and add some dependencies
(def tracker (-> (ns-track/tracker)
                 (ns-track/add '{alpha #{beta}
                                 beta  #{gamma delta}})))

;; now add a new dependency and check what we need to unload and load
(-> tracker
    (ns-track/add '{epsilon #{}})
    (select-keys [
        ])){:unload (epsilon alpha beta),
                                :load (epsilon beta alpha)}

I don't understand why alpha and beta are required to unload/load but maybe I'm missing something.

I'm using the latest version.


1 Answer

0 votes

Initially, everything needs to unload/load. This is because when refreshing, there isn't anything tracking code loaded time vs file modification time. So the initial load/unload is everything.

As reload runs against everything it will remove nodes from :unload as it goes.

I'm not sure what behavior you're expecting from this. But I would guess that initially you don't want anything to be in the unload/load lists. I would using assoc to set those keys to [].

Already figured out that you need to dissoc unload and loads when processing them, I was confused because I was expecting a tracker api for this. Thanks!