It seems CLJS is complaining about a dynamic var that's private being used in binding:
WARNING: var: sci.ctx-store/*ctx* is not public at line 21 /Users/borkdude/dev/babashka/sci/src/sci/impl/interpreter.cljc
WARNING: var: sci.ctx-store/*ctx* is not public at line 21 /Users/borkdude/dev/babashka/sci/src/sci/impl/interpreter.cljc
which in JVM Clojure is perfectly fine behavior. The use case in JVM Clojure for this is often to write macros like with-something that bind the (private) dynamic var for you, while not exposing the var directly as a public APIRepro:
$ clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "RELEASE"}}}' -M -m cljs.main -re node
ClojureScript 1.12.42
cljs.user=> (ns foo)
WARNING: foo is a single segment namespace at line 1 <cljs repl>
nil
foo=> (def ^:dynamic ^:private *foo*)
#'foo/*foo*
foo=> (ns dude)
WARNING: dude is a single segment namespace at line 1 <cljs repl>
nil
dude=> (binding [foo/*foo* 10])
WARNING: var: foo/*foo* is not public at line 1 <cljs repl>
WARNING: var: foo/*foo* is not public at line 1 <cljs repl>
In the JVM:
$ clj
Clojure 1.12.1
user=> (ns foo)
nil
foo=> (def ^:dynamic ^:private *foo*)
#'foo/*foo*
foo=> (ns dude)
nil
dude=> (binding [foo/*foo* 10])
nilhrm - how does that work in Clojure? Old CLJS issue for sure
I think clojure doesn't complain because (var foo/private-var) never complains
no big issue, I'll just document in the docstring that this shouldn't be used directly and hide it from the API docs
is private also used for optimizations in CLJS/closure? I guess not right? just something that only exists at compile time?
so that's like some kinda of trick that the macro writer does?
that a big no-no for DCE to use (var ...) like that.
I'm not suggesting to do this in CLJS, I know it's not good for bundle size to use var. Just explaining how the Clojure (JVM) mechanism works.
The CLJS compiler could just not warn for private access of dynamic vars in certain macros, not sure if that's the best solution.
The binding macro generates a map with vars in JVM Clojure
I think this is just a difference, not really interested in messing around here anymore
understandable
there is ^:cljs.analyzer/no-resolve - maybe that works for this pattern?
do you mean in user space?
it's just meta data you can put on any symbol
sure. I thought this was an internal compiler convention, but if it's also public, I'm willing to use it
it's an internal detail for sure - just not sure what you're trying to do so just throwing it out there
I'm pretty sure it's a supported pattern in Clojure to write macros that use private vars without letting users use the private var directly, just don't remember the classic example in core itself. But no sweat, I solved it another way now
yes I know it's supported but I don't see any good way to make it work
the problem is you can't use this specific trick from Clojure since there are no real vars, and I don't really want to add something just for this case.
no worries, there are more ways to indicate that this var shouldn't be used directly.