Hacker News new | ask | show | jobs
by Scarbutt 1927 days ago
Clojurescript still has the annoying problem of having to convert between the two language data structures. So even with shadow-cljs(no idea how good it is) Cljs is no smooth sailing either. Immer seems to be the best compromise and more ergonomic approach to immutability in JS. Immutability is also needed much less in single-threaded environments where JS operates where async code is pretty much used for IO 99% of the time.
1 comments

Agree that converting between JS and CLJS data structures is a pain.

The best approach to dealing with that is to isolate that interop at the edges of your program.

I’m currently, coincidentally, working on a wrapper for Express to do just that. The wrapper library is responsible for mapping between the Express req/res objects to simple ClojureScript maps. Combine that with a similar wrapper around something like fetch or axios and all my code can be pure ClojureScript.

I mean, that is the general practice in Clojure/Java land. Write wrappers around the native libraries to isolate the pain that comes from interop.

I’m a sucker for Clojure though, and willing to do the work.