Hacker News new | ask | show | jobs
by LandR 2495 days ago
Has anyone done both elm and clojure script for Web work? Which did you prefer, which had the best tooling etc?

I need to learn Web, as mucj as I don't want to, and love clojure and fp. Also figwheel looks awesome, but how hard is it to setup.

I also think maybe to really get the best out of clojure script you also need to learn react??

I'm not sure this is the case with elm.

Any other non js alternatives?

2 comments

I have about two years of professional experience working with ClojureScript, and about three years professional experience working with Elm.

There’s almost no comparison.

Elm compiles much more quickly.

Elm produces much more performant code.

Elm enables you to write software that works reliably much more quickly because type errors happen at compile time, rather than at runtime like in ClojureScript.

ClojureScript’s error messages are at times incomprehensible. Elm’s error messages are best in class.

Elm is far easier to learn than ClojureScript, and you’re right — you do need to know React if you’re writing a non-trivial ClojureScript application.

Elm is criticised for not allowing a synchronous IO escape hatch. This is a pretty bad criticism I think. Being able to guarantee where effects won’t happen is a pretty great thing. Any effects work and/or JS interop can be done with ports. Ports work just fine.

Elm is also criticised for denying the user a lot of “power features” like typeclasses. I find it mildly annoying sometimes that I don’t have everything I want, but I understand the trade-off. This is to make the language more accessible to your average JavaScript developer who has never tried anything from this family of languages. And I sure as hell don’t find it annoying enough to want to drop the type-checking compiler.

Elm's FFI is a bit painful compared to Clojurescript's. With Clojurescript you can target Node, browser or mobile (with something like Re-natal), but it truly shines when you have Clojure on the back-end. Clojure runs on JVM and many people (for all the wrong reasons) don't like that.

You don't need to learn React to start using Re-agent or Re-frame.

IMO among all alt-js languages, Clojurescript is the most practical and production-ready.