Hacker News new | past | comments | ask | show | jobs | submit login

> [C]ould I start using something like ClojureScript instead of Javascript and be able to use the libraries I currently use, like I would with coffeescript?

Clojure has an opinionated idea about how data should be handled and changed over time. This interacts very poorly with data binding so if your current libraries are Ember, Angular, Knockout, or the like then the answer is no. You can call into any JS library fairly easily so if you want to use jQuery, d3, three, or whatnot then it's doable but not in the "it's just javascript" way of coffeescript.

On the other hand, Clojure fits into the React model like toothpaste in tubes and the community has switched almost universally (save the Hoplon guys) to one of the React wrappers. I recommend starting with Reagent [1]. Om has more mindshare but Reagent's model is considerably simpler. If you need more structure around the app, check out Re-frame [2]. In either case you want to set up your project with figwheel [3] (lein new figwheel <project>) and add reagent/re-frame as a dependency.

[1] http://holmsand.github.io/reagent/ [2] https://github.com/Day8/re-frame/ [3] https://github.com/bhauman/lein-figwheel

I encourage you to give the langauge a try but I don't really recommend Clojurescript at work unless you're already working at a Clojure shop. The language is nicer than Javascript and I care enough about that to take a job working in cljs full time but the language isn't mature nor enough of a productivity boost over js (especially babelized js) to justify saddling your company with a niche language maintenance burden when you leave. If you're going to evangelize, I recommend starting in Clojure where the win over Java is much, much bigger.

P.S. I use Vim for everything non-lisp but I use Emacs with Evil mode for lisps. Evil mode is bar none the best vim emulator I've used and is the only one I can stand to use on an extended basis.

I don't think Om necessarily has more mindshare (although it does have a significant amount), just that Reagent people are a perhaps a little less vocal (or at least, have their discussions on their own mailing list).

I would also recommend Reagent + re-frame + figwheel, which I'm using for my current project after having used Om for many months previously. Its an excellent model for writing complex apps.

Big +1 for reagent + reframe + figwheel.

We're using it to build a medium-large web app and it's been working out great. Being able to reason about the state of UI hasn't been this easy for me before.

Thanks for the writeup! I'm currently experimenting with Ring/Liberator on the server side and Mithril on the client, and was unsure whether I should just use ClojureScript or plain JS. I chose plain JS for simplicity, but damn, reagent and figwheel look like a killer combination. To me it seems client side Clojure is a bit harder at first than server side, since most of it has to do with mutating DOM state - do you think thats true?

It is difficult, which is why Clojurescript adoption didn't really take off until React (via Om) showed up. The whole point of the virtual dom model is to avoid stateful DOM manipulation and instead have view code that is an idempotent (and generally pure) transformation from app state to virtual dom. This is a great fit for any functional programming language and makes keeping the DOM in sync mostly a solved problem.

I haven't tried Mithril in cljs personally but it fits the model so you should be fine with just writing a wrapper function or macro to save some boiler plate on the cljs to js data structure conversion.

The challenges in the cljs app I'm working on are the same challenges you run into any app: how do you separate concerns, where does state reside, how do you keep it in sync with the server, etc. A problem that's unique to React based apps is how to get data from your app state to a component without higher level components needing to be changed.

My main annoyance with cljs is that rethrowing errors in Chrome swallows the stack trace and core.async wraps everything in a try/catch block. This means that you need to debug by breaking on error, typing `ex.stack` in the console, and reading compiled JS frames to find the source.

Sounds like React is going on my todo list (picked AngularJs for my current project so have to stick with it).

Great suggestions btw, and I absolutely agree with Clojures a big win over Java, I was actually very briefly learning myself Clojure during Java and algo labs but the teachers didn't appreciate that at all :(

> P.S. I use Vim for everything non-lisp but I use Emacs with Evil mode for lisps. Evil mode is bar none the best vim emulator I've used and is the only one I can stand to use on an extended basis.

I love reading that, I have been using Vim for 4 years or so, but for a month or two I actually managed to switch to emacs with evil-mode. I did however notice that my knowledge of the different modes was too limited, and I was basically just using vim in emacs, so dropped it again. Since today I actually switched back to Emacs, found my self-written cheat-sheet and so far it's going great (no evil-mode so far).

Good summary but I disagree that jumping off a cliff with 3 other guys is always a bad idea. Sometimes you can grow wings and sour over the beautiful mountains others are struggling to climb

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact