sci

jyn 2025-08-18T03:33:50.382979Z

i've found that SCI doesn't return a traceback for errors if the code i pass was syntax-quoted instead of normal quoted:

user=> (defn sci-data [code] (try (sci/eval-form (sci/init {}) code) (catch clojure.lang.ExceptionInfo e (prn (ex-data e)))))
#'user/sci-data
user=> (sci-data `(~'a ~'b ~'c))
{:type :sci/error, :line nil, :column nil, :file nil, :phase "analysis"}
nil
user=> (sci-data '(a b c))
{:type :sci/error, :line 1, :column 12, :message "Could not resolve symbol: a", :sci.impl/callstack #object[clojure.lang.Volatile 0x5eae58d {:status :ready, :val ({:line 1, :column 12, :ns #object[sci.lang.Namespace 0x7c3af34a "user"], :file nil})}], :file nil, :phase "analysis"}
nil
i looked at the types and the only difference i see is that syntax-quotes generate a Cons and normal quotes generate a PersistentList. why does that difference matter?

✅ 1
jyn 2025-08-18T03:56:34.517019Z

i've found that the code that makes this decision is https://github.com/babashka/sci/blob/56104c81cb7a3804f8ee84aa64b313dc7143f30e/src/sci/impl/utils.cljc#L97 but i don't quite follow what it's doing tbh

borkdude 2025-08-18T08:04:13.412139Z

I think the difference here is that a quoted list in Clojure itself has a location but syntax-quoted stuff doesn't.

user=> (meta '(a b c))
{:line 1, :column 8}
user=> (meta `(~'a ~'b ~'c))
nil

jyn 2025-08-18T14:30:53.459789Z

ohhh i see