sci

jyn 2025-08-07T18:06:30.970939Z

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

borkdude 2025-08-07T18:10:44.420059Z

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

jyn 2025-08-07T18:10:45.531559Z

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

borkdude 2025-08-07T18:11:53.181899Z

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

borkdude 2025-08-07T18:13:17.571899Z

do you understand?

borkdude 2025-08-07T18:18:11.799499Z

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

borkdude 2025-08-07T18:33:10.737649Z

I pushed a fix to the master branch anyway

jyn 2025-08-07T20:13:02.942639Z

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

jyn 2025-08-07T20:13:24.780659Z

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

borkdude 2025-08-07T20:15:15.665159Z

ok, use SCI from master then

👍 1
jyn 2025-08-07T18:06:42.518499Z

agh

jyn 2025-08-07T18:06:46.728079Z

sorry i don't know how to use slack apparently