在你的想法中分享 2024年Clojure状态调查!

欢迎!请查看关于页面,了解更多关于这个平台的信息。

0 投票
ClojureScript

在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: No such namespace: string, could not locate string.cljs at line 1
WARNING: Use of undeclared Var string/blank? at line 1
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>
`

1 答案

0 投票
...