sci 2025-08-07

if i set sci/ns to a different namespace, i stop being able to define variables. why does that happen? does it expect me to run (ns) or something?

user=> (sci/binding [sci/ns (sci/create-ns 'xxx)] (sci/eval-string "(def x 'x)"))
Execution error (NullPointerException) at sci.impl.analyzer/init-var! (analyzer.cljc:707).
Cannot invoke "java.util.Map.get(Object)" because "the_current_ns" is null

Hmm, I think this should work. Let's take a look...

using (eval-string "(ns xxx) (def x 'x)") indeed works fine. why is that necessary?

Ah, I think this happens when you try to evaluate this without actually having that namespace in {:namespaces {'xxx {}}}

do you understand?

I can fix this but it's quite unusual. How did you arrive in this situation?

I pushed a fix to the master branch anyway

> How did you arrive in this situation? i am generating namespaces dynamically at runtime

the user can write clojure files at a path of their choosing and i inject it into the SCI context

ok, use SCI from master then

👍 1

sorry i don't know how to use slack apparently