if i run (ns xyz) in an SCI script, i get an error saying "Can't change/establish root binding of #'clojure.core/*ns* with set". what's the reason for that restriction?
You mean with eval-form ?
yes
There’s docs about this I think, eval-form is a lower level thing, you need to wrap it in a sci/binding with sci/ns
oh interesting, ok
Might be in the readme
AFK but will be back later
there are absolutely docs on eval-form itself
oops
ty!
hm, i'm getting a similar error but for a global variable:
Can't change/establish root binding of: out with set
that's from this code:
(def ^{:private true} out {})
(defn rule [opts]
(set! out (update out :rules conj opts)))
presumably the set! here is what goes wrong? i guess because it works on Vars, not symbols?do i really have to declare all Vars in advance with new-var?
oh i see, this is a clojure error, not a SCI one, this happens in the repl too
@jyn514 if you are trying to alter the value of a var, you can use alter-var-root