Fork me on GitHub
#scittle
<
2023-01-05
>
Bingen Galartza Iparragirre07:01:41

Hello! Is not being able to destructure defmethod parameters a known limitation? or maybe a bug? For example, with the following code:

(defmulti greeting :language)

(defmethod greeting :english
  [{:keys [friend]}]
  (prn (str "Hello " friend)))
I get the following error:
---- Scittle error ------------------------------
Message:  Could not resolve symbol: friend
Data:      {:type :sci/error, :line nil, :column nil, :file "profile_picker.cljs", :phase "analysis"}
Location: profile_picker.cljs:11:8 scittle.js:587:452
Phase:    analysis scittle.js:587:452
----- Context ------------------------------------ scittle.js:587:452

07  (defmulti greeting :language)
08  
09  (defmethod greeting :english
10    [{:keys [friend]}]
11    (prn (str "Hello " friend)))
           ^--- Could not resolve symbol: friend
12  
13  
14  (defn main
15    []
16    (let [settings (rf/subscribe [::settings/settings])] scittle.js:587:452
Thank you!

borkdude08:01:42

This is fixed in a new version of SCI. I’ll release a new version of scittle, then this will be supported

borkdude10:01:39

0.5.14 is now released

Bingen Galartza Iparragirre11:01:33

Wow, that was fast! Thanks a ton

borkdude11:01:06

Sure. If you're comfortable sharing, let us know what you're doing with scittle :)

Bingen Galartza Iparragirre13:01:16

Sure! We are building a web-based wizard for the https://www.gethop.dev/ . For bootstrapping new HOP projects we are using edn files, but they are a bit long and tedious to edit. So we wanted to have a UI that would facilitate that job. As we are experienced in building web applications in CLJS we thought Scittle would be a perfect fit because: • We can integrate it in our https://github.com/gethop-dev/hop-cli (based on Babashka) using http-kit server. • It's easy to setup and we don't need to incorporate any CLJS compiler. • It has all the ingredients we need to build a simple UI with technologies that we already master: reagent and re-frame

Bingen Galartza Iparragirre13:01:08

Still early stage (no styling yet), but looking good.

👍 2
borkdude10:01:34

https://github.com/babashka/scittle: execute Clojure(Script) directly from browser script tags via SCI! v0.5.14 (2023-01-05) • Fix destructuring in defmethod (by upgrading SCI)

👌 8
🚀 4