This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-03
Channels
- # adventofcode (2)
- # announcements (1)
- # asami (35)
- # babashka (67)
- # beginners (97)
- # cherry (3)
- # clj-yaml (3)
- # cljsrn (9)
- # clojure (44)
- # clojure-dev (34)
- # clojure-europe (13)
- # clojure-gamedev (1)
- # clojure-norway (10)
- # clojure-uk (2)
- # clojurescript (24)
- # clr (1)
- # conjure (18)
- # cursive (4)
- # datalevin (3)
- # emacs (6)
- # graalvm (9)
- # graphql (1)
- # introduce-yourself (1)
- # malli (7)
- # nrepl (3)
- # portal (1)
- # quil (2)
- # reagent (1)
- # reitit (21)
- # releases (1)
- # reveal (11)
- # ring (2)
- # shadow-cljs (17)
- # sql (24)
- # vim (4)
Should :exclude
-ing ns
be supported?
user=> (ns foo (:refer-clojure :exclude [ns]))
nil
foo=> (resolve 'ns)
#'clojure.core/ns
This doesn't work for me either:
bar=> (ns-unmap *ns* 'ns)
nil
bar=> (resolve 'ns)
#'clojure.core/ns
It seems there is a hardcoded case for this: https://github.com/clojure/clojure/blob/527b330045ef35b47a968d80ed3dc4999cfa2623/src/jvm/clojure/lang/Compiler.java#L7446
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.core
You 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
(namespace (symbol #'inc))
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
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
committed in t.b - do you need a release?
I still come across this interop a lot, e.g. recently I made a PR here: https://github.com/borkdude/hyperfiddle-rcf/commit/9ce258d75a87cd8c8d9ab6b5fa01f3ca37a29782
I committed the switch in spec.alpha too
it already depends on 1.10.3
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