3 ms·
While you can use ClojureScript (CLJS) server-side running on say node.js, the largest benefit is as a replacement for client-side JS (ClojureScript converts to
by aria 14y ago
While you can use ClojureScript (CLJS) server-side running on say node.js, the largest benefit is as a replacement for client-side JS (ClojureScript converts to JS at compile-time).
You can actually use all the libraries you mentioned (jQuery, underscore) from ClojureScript. What CLJS really brings to the table are a set of abstractions and data structures that make it easier to write strong reusable functional code. In fact, alot of underscore comes built into CLJS and I think much of what jQuery buys you can be handled as a good CLJS library (but more on that soon!)
- weareconvo 14y agoThe idea of decomposing jQuery into small libraries Clojure-style is very appealing. The advantage would be building the specific Javascript file needed by the client at request time, and caching intelligently to prevent doing this too much. The extra benefit would be, you could break out the pieces of jQuery devoted to patching cross-browser issues, and only include the ones you really cared about. Very cool!
- aria 14y agoYeah absolutely. One of the better CLJS features is getting the Google Closure modules and explicit dependencies. We'll probably add dom selectors and/or manipulation and wheter it's the same library as dommy (github.com/prismatic/dommy) or a different one will depend on if the selectors borrow the same abstractions and syntax as templating.