-
-
Save nathanmarz/6c3461fd9f45e28248ace85eaee5a4f5 to your computer and use it in GitHub Desktop.
Multiple namespace loading behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (require 'test-ns) | |
Loading... | |
nil | |
user=> (require 'test-ns) | |
nil | |
user=> (require 'test_ns) | |
"Loading... | |
nil | |
user=> (require 'test_ns) | |
nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns test-ns) | |
(println "Loading...) |
Addendum: There is additional error checking in require
that checks whether the namespace with the require'd name was created when require is nearly done, but it is only enabled if you use the :as
clause. Example given the contents of test_ns.clj above:
user=> (require '[test_ns :as myalias])
Loading...
Syntax error compiling at (REPL:1:1).
namespace 'test_ns' not found after loading '/test_ns'
That additional error checking is also enabled by doing (use 'test_ns)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Weird. Note that doing the require of test-ns first causes only
test-ns
to be added to theclojure.core/*loaded-libs*
set, whereas doing require of test_ns first causes bothtest-ns
andtest_ns
to be added toclojure.core/*loaded-libs*
.