sci

jyn 2025-08-24T06:08:07.995129Z

i am getting crashes from SCI when i do all of the following: • bind sci/file to a string • bind some variable in the user namespace with sci/init • eval a piece of code that tries to reassign that variable

user=> (sci/binding [sci/file "<repl>"] (sci/eval-form (sci/init {:namespaces {'user {'x "xxx"}}}) '(def x :y)))
Execution error (ClassCastException) at sci.impl.analyzer/init-var! (analyzer.cljc:666).
class java.lang.String cannot be cast to class clojure.lang.IReference (java.lang.String is in module java.base of loader 'bootstrap'; clojure.lang.IReference is in unnamed module of loader 'app')
i am not sure where to go from here, i think this is an SCI bug?

✅ 1
jyn 2025-08-24T06:11:29.166349Z

the code that's crashing is https://github.com/babashka/sci/blob/master/src/sci/impl/analyzer.cljc#L666

jyn 2025-08-24T06:16:02.364649Z

agh the problem is that i need to use copy-var instead of binding values directly

jyn 2025-08-24T06:18:37.755449Z

sci/new-var 'x "xxx" also works 🥲

jyn 2025-08-24T06:19:00.822189Z

ok i will make a note that anything that can be rebound in the guest needs to be a proper Var and not just a value

👍 1