sci

jyn 2025-07-26T18:06:11.846839Z

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?

✅ 1
borkdude 2025-07-26T18:06:41.416719Z

You mean with eval-form ?

jyn 2025-07-26T18:06:51.755989Z

yes

borkdude 2025-07-26T18:07:39.364309Z

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

jyn 2025-07-26T18:07:46.525959Z

oh interesting, ok

borkdude 2025-07-26T18:07:51.142759Z

Might be in the readme

borkdude 2025-07-26T18:08:00.727379Z

AFK but will be back later

jyn 2025-07-26T18:08:03.438409Z

there are absolutely docs on eval-form itself

jyn 2025-07-26T18:08:04.219809Z

oops

jyn 2025-07-26T18:08:05.320139Z

ty!

jyn 2025-07-26T19:40:12.613289Z

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?

jyn 2025-07-26T19:41:05.849999Z

do i really have to declare all Vars in advance with new-var?

jyn 2025-07-26T19:49:48.188129Z

oh i see, this is a clojure error, not a SCI one, this happens in the repl too

borkdude 2025-07-26T20:31:51.852309Z

@jyn514 if you are trying to alter the value of a var, you can use alter-var-root

👍 1