在Clojure REPL中,可以再次声明相同的命名空间,不会修改或删除现有的命名空间别名
`
user=> (ns my-test-ns.core (:require [clojure.string :as string]))
nil
my-test-ns.core=> (def a string/blank?)
'my-test-ns.core/a
my-test-ns.core=> (ns my-test-ns.core)
nil
my-test-ns.core=> (def a string/blank?)
'my-test-ns.core/a
my-test-ns.core=>
`
ClojureScript REPL的行为不相同
`
ClojureScript:cljs.user> (ns my-test-ns.core (:require [clojure.string :as string]))
true
ClojureScript:my-test-ns.core> (def a string/blank?)
<function clojure$string$blankQMARK(s){
return goog.string.isEmptySafe(s);
}>
ClojureScript:my-test-ns.core> (ns my-test-ns.core)
nil
ClojureScript:my-test-ns.core> (def a string/blank?)
WARNING: 未找到命名空间:string,无法找到文件string.cljs,行1
WARNING: 在行1使用未声明的Var string/blank?
repl:13
throw e3919auto__;
^
ReferenceError: string is not defined
at repl:1:109
at repl:9:3
at repl:14:4
at Object.exports.runInThisContext (vm.js:74:17)
at Domain.<anonymous> ([stdin]:41:34)
at Domain.run (domain.js:197:16)
at Socket.<anonymous> ([stdin]:40:25)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
ClojureScript:my-test-ns.core>
`