Fork me on GitHub
#clojure-dev
<
2023-01-03
>
bronsa10:01:34

hmm, those all cause an exception to be thrown in tools.reader

bronsa10:01:29

ah nevermind, with :features #{:clj} those read exactly like in lispreader.java

borkdude19:01:34

Should :exclude -ing ns be supported?

user=> (ns foo (:refer-clojure :exclude [ns]))
nil
foo=> (resolve 'ns)
#'clojure.core/ns

borkdude19:01:18

This doesn't work for me either:

bar=> (ns-unmap *ns* 'ns)
nil
bar=> (resolve 'ns)
#'clojure.core/ns

borkdude19:01:48

I'd post an issue (+ patch) after receiving some feedback on this

borkdude19:01:46

I think I found a workaround using definterface

Alex Miller (Clojure team)19:01:18

not sure what you're looking for, it's a special case

borkdude19:01:54

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

borkdude19:01:42

but I managed to work around it using definterface:

$ ./sci "(let [v #'inc] (.name (.ns v)))"
clojure.core

borkdude19:01:19

You might wonder why: well, I'm trying to make a library that you wrote compatible with bb, without changing it too much ;)

Alex Miller (Clojure team)19:01:21

I think there is a better option for that idiom now

borkdude19:01:07

perhaps:

user=> (-> #'inc symbol namespace)
"clojure.core"

Alex Miller (Clojure team)19:01:08

(namespace (symbol #'inc))

Alex Miller (Clojure team)19:01:31

we made those changes to symbol in 1.9 or 1.10

borkdude19:01:03

cool, then I'll roll back my changes :)

borkdude19:01:38

the full idiom is: (-> #'inc symbol namespace symbol) to get back a namespace symbol

borkdude19:01:53

This was introduced in 1.10, I guess clojure spec was introduced in 1.9 right

Alex Miller (Clojure team)19:01:39

committed in t.b - do you need a release?

borkdude19:01:17

not necessary - thanks!

borkdude19:01:36

I still come across this interop a lot, e.g. recently I made a PR here: https://github.com/borkdude/hyperfiddle-rcf/commit/9ce258d75a87cd8c8d9ab6b5fa01f3ca37a29782

Alex Miller (Clojure team)20:01:23

yeah, this was a common thing, that's why we modified symbol

👍 2
Alex Miller (Clojure team)20:01:26

I committed the switch in spec.alpha too

borkdude20:01:56

wouldn't that make spec.alpha incompatible with 1.9?

Alex Miller (Clojure team)20:01:10

it already depends on 1.10.3

borkdude20:01:28

cool, then I can remove one more diff in babashka.spec.alpha!

borkdude20:01:33

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

borkdude20:01:10

I guess:

(symbol (str (.name *ns*)) (str s))
could also use ns-name

borkdude20:01:39

or simply str