hmm, those all cause an exception to be thrown in tools.reader
ah nevermind, with :features #{:clj} those read exactly like in lispreader.java
Should :exclude -ing ns be supported?
user=> (ns foo (:refer-clojure :exclude [ns]))
nil
foo=> (resolve 'ns)
#'clojure.core/nsThis doesn't work for me either:
bar=> (ns-unmap *ns* 'ns)
nil
bar=> (resolve 'ns)
#'clojure.core/nsI'd post an issue (+ patch) after receiving some feedback on this
It seems there is a hardcoded case for this: https://github.com/clojure/clojure/blob/527b330045ef35b47a968d80ed3dc4999cfa2623/src/jvm/clojure/lang/Compiler.java#L7446
I think I found a workaround using definterface
not sure what you're looking for, it's a special case
I was trying to define a protocol with an ns method to get compatibility in SCI with clojure.lang.Var but this isn't possible without emitting warnings
but I managed to work around it using definterface:
$ ./sci "(let [v #'inc] (.name (.ns v)))"
clojure.coreYou might wonder why: well, I'm trying to make a library that you wrote compatible with bb, without changing it too much ;)
I think there is a better option for that idiom now
perhaps:
user=> (-> #'inc symbol namespace)
"clojure.core"(namespace (symbol #'inc))yeah
we made those changes to symbol in 1.9 or 1.10
agreed. would you consider changing it here? https://github.com/clojure/tools.build/blob/5624ba3e0327e0e1a214b77c7b6b033bd2f6e6f0/src/main/clojure/clojure/tools/build/tasks/compile_clj.clj#L33
sure
cool, then I'll roll back my changes :)
the full idiom is: (-> #'inc symbol namespace symbol) to get back a namespace symbol
There's also a similar thing here https://github.com/clojure/spec.alpha/blob/251c10b2199d0398bc19b3295166d35f8e6e198f/src/main/clojure/clojure/spec/alpha.clj#L305
This was introduced in 1.10, I guess clojure spec was introduced in 1.9 right
yeah
committed in t.b - do you need a release?
not necessary - thanks!
I still come across this interop a lot, e.g. recently I made a PR here: https://github.com/borkdude/hyperfiddle-rcf/commit/9ce258d75a87cd8c8d9ab6b5fa01f3ca37a29782
yeah, this was a common thing, that's why we modified symbol
I committed the switch in spec.alpha too
wouldn't that make spec.alpha incompatible with 1.9?
it already depends on 1.10.3
cool, then I can remove one more diff in babashka.spec.alpha!
I also updated babashka spec alpha with the latest spec alpha changes (pull upstream)
If you're interested, the diff is here:
https://github.com/clojure/spec.alpha/compare/master...babashka:spec.alpha:babashka?w=1
The biggest difference is clojure.lang.Compiler/demunge not (yet) being available in bb, so it works around that by using clojure.main/demunge
I guess:
(symbol (str (.name *ns*)) (str s))
could also use ns-nameor simply str