This situation is quite tricky to reproduce. First I create a clj file containing:
(ns myns)
(defn myfn [x] x)
Then I create a second clj file containing:
(ns myns2
(:require [myns :as m]
[clojure.repl :as repl]))
(comment
(second (iterate repl/source-fn 'm/myfn))
(take 2 (iterate repl/source-fn 'm/myfn))
)
Then I start a REPL and load the second file in that. Finally I evaluate both comments by sending them to the REPL. The first expression will yield "(defn myfn [x] x)"
as expected. However the second expression yields '(m/myfn nil)
. What is going on here?
Note that fully qualifying 'm/myfn as 'myns/myfn restores matching behavior. Also I understand that iterating source-fn is kinda wacky, but it's the simplest way I know to reproduce the behavior.
Aucun commentaire:
Enregistrer un commentaire