1. 13

  2. 5

    Interesting article, I think this sums up nicely a lot of the draw and the barriers of cljs adoption. I’m a Clojure dev at my day job but have done a couple of internal tools in clojurescript and a lot of your criticisms resonate (some are true of both clojure and cljs). I’ll address a couple though:

    I think your issues with a lack of repl and long startup time could be solved by altering your workflow somewhat. Coming from a Clojure background I tried to move all of my development practices whole hog to cljs and I didn’t have a lot of success with that. That said there has been a MASSIVE effort on tooling from the clojurescript community. Originally I worked with projects using lein + cljs-build and as you say it’s slow and tedious to rebuild the project, refresh the browser, etc. Figwheel, however, is fantastic. It provides automatic compilation + and pushes changes live to the browser and is an absolute pleasure to work with. You only have to run lein once and keep it going in the background. It’s not strictly a repl, but the instant feedback is just as conducive to experimentation as a repl would be. There’s an excellent minimal workflow in the first om.next quickstart) that I’ve found to be very easy to start with.

    In terms of actual repl integration, NREPL-based solutions are extremely painful to get running and the clojure community working on the design of simpler socket-based server that I imagine will probably be ported to cljs should it prove successful.

    As for types, It’s not exactly a complete end to end type-based solution, but prismatic’s schema is a pretty interesting way to annotate code and define the shape of data with types, you can also use it to run type validation either in tests or live (or even limit type checking to your dev environment). It’s not as comprehensive as something like core.typed but it works in clojurescript and the annotation is generally quite nice to write. It also allows you to write fancier specifications to check input and output with predicates.

    I hope you find a way of working in clojurescript projects that works for you.

    1. 2

      Thanks! Yeah, I’m a bit less excited by run-time type checking from an “improve my development experience” perspective, b/c I have to get it into a state where that function is called, etc. But I’ll have to try schema out. Figwheel does seem really cool : now I just need a way to hook up the devtools console to it :)

      1. 2

        Figwheel does have a REPL as well, and can be integrated into most Clojure dev environments. It’s particularly nice because it is integrated with the auto reloader, so you don’t have to manually reload your code after you make a change.

      2. 2

        We’re doing clojurescript in production now, and I can echo what angusiguess said that Figwheel makes development very nice. As soon as I write the buffer in emacs my changes are automatically reloaded in the browser. You can also run cider in emacs which provides a nice repl, I tend to just leave it running in an open buffer.