sci

o位v 2025-12-15T18:18:05.930959Z

Hey I'd like SCI to resolve undefined symbols to nil instead of throwing "Could not resolve symbol: x". Is there a natural way to do this?

o位v 2025-12-16T22:16:20.234829Z

Yeah, I think that's fine for now :^)

borkdude 2025-12-16T22:35:52.176079Z

what's your use case for this feature btw?

o位v 2025-12-17T17:13:48.859719Z

I've created a web app for creating and editing hiccup templates such that changes to the templates are reflected immediately in the app using the templates. Change a color in the template and the color immediately changes in the app. Since this updates on every keystroke I often times get into invalid states and I don't want the app to flash every time that happens. Therefore I'm using some heuristics to handle the most common such cases. One such common case I've found, is accessing unbound symbols. I'm using parmezan for this also, so that I can actually see the results while in the middle of typing e.g [:div [:span "foo . Thank you for parmezan 馃!

borkdude 2025-12-17T17:14:35.651529Z

:-D

o位v 2025-12-17T17:25:48.389079Z

This here (sorry for two clips, screen recording is a bit crashy for me)

borkdude 2025-12-17T18:28:29.681599Z

nice. is this in a JS environment?

borkdude 2025-12-17T18:28:50.949509Z

you could use codemirror + clojure-mode for automatic paren matching

o位v 2025-12-17T22:28:14.212489Z

This is an Electric Clojure app so both JVM and JS :^)

o位v 2025-12-17T22:28:39.564669Z

I guess it doesn't show in the clips I sent but left and right side run in different browser tabs

o位v 2025-12-17T22:28:53.299199Z

I'll take a look at codemirror and clojure-mode 馃

馃憤 1
borkdude 2025-12-17T22:29:28.001999Z

this playground uses it for example: https://babashka.org/sci.configs/

o位v 2025-12-17T22:30:25.616809Z

waaaaaaa

o位v 2025-12-17T22:30:27.570579Z

that's awesome

o位v 2025-12-17T22:30:32.394439Z

I'll definitely use that!

o位v 2025-12-15T18:36:38.022379Z

Me and Claude landed on this which works for me :^)

;; Patch SCI so undefined symbols resolve to nil instead of throwing
(defn- resolve-symbol-lenient
  ([ctx sym] (resolve-symbol-lenient ctx sym false nil))
  ([ctx sym call?] (resolve-symbol-lenient ctx sym call? nil))
  ([ctx sym call? m]
   (second
    (or (sci-resolve/resolve-symbol* ctx sym call? m)
        [nil nil]))))

#?(:clj (alter-var-root #'sci-resolve/resolve-symbol (constantly resolve-symbol-lenient))
   :cljs (set! sci-resolve/resolve-symbol resolve-symbol-lenient))

o位v 2025-12-15T18:37:08.373019Z

Thanks for the great library!

馃憤 1
borkdude 2025-12-15T18:58:55.410979Z

Be aware that changing something in a namespace called .impl may change at any time