Skip to content

Instantly share code, notes, and snippets.

@nathanmarz
Created July 31, 2019 19:13
Show Gist options
  • Save nathanmarz/6c3461fd9f45e28248ace85eaee5a4f5 to your computer and use it in GitHub Desktop.
Save nathanmarz/6c3461fd9f45e28248ace85eaee5a4f5 to your computer and use it in GitHub Desktop.
Multiple namespace loading behavior
user=> (require 'test-ns)
Loading...
nil
user=> (require 'test-ns)
nil
user=> (require 'test_ns)
"Loading...
nil
user=> (require 'test_ns)
nil
(ns test-ns)
(println "Loading...)
@jafingerhut
Copy link

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