clerk
clerk copied to clipboard
dependency resolution in case of double defined defs is non-deterministic
Code such as
(def a 1)
...
...
(def a 2)
(+ a 1)
in an notebook results sometimes in 2 , sometimes in 3
Code like thgis coukld detect such as situation:
(def parsed
(clerk/parse-file "notebooks/duplicate.clj"))
(def analyzed
(h/build-graph parsed))
(def duplicate-vars
(->> analyzed :doc :blocks (map :var) frequencies (filter (fn [[key val]] (> val 1))) keys vec))
I propose to run such a detection during analysis, and fail on it for now, saying:
"Clerk's dependency analysis and caching cannot handle redefined vars"
The following vars are redefined ....
Having this in a namespace can result in un-noticeable and hard to debug issues.