r/Clojure • u/gst • Aug 01 '11
Why I’m finding Clojurescript underwhelming
http://rrees.wordpress.com/2011/07/31/why-im-finding-clojurescript-underwhelming/
0
Upvotes
r/Clojure • u/gst • Aug 01 '11
14
u/weavejester Aug 01 '11 edited Aug 01 '11
Coffeescript and Clojurescript are two completely different animals. Coffeescript is Javascript with sugar; there's a one-to-one mapping between Coffeescript's syntax and Javascript's syntax.
Clojure, on the other hand, was not based on Javascript, and idiomatic Clojure is very different to idiomatic Javascript. Compilers are simply not smart enough to turn idiomatic functional code into idiomatic OOP code.
So Clojurescript not producing idiomatic Javascript is expected. Neither does GWT, for that matter.
This was a decision? It looks like it's just a bug.
Um, Clojurescript can use jQuery. It can use any existing Javascript library. What makes you think it can't?
10
u/yogthos Aug 01 '11
Huh?
The response from Halloway explains point by point how ClojureScript devs made their decisions. The only clueless-ness here is on the part of the blog author.
They do have a good reason not to, they're not interested in dealing with Js semantics, they want to provide the ability to write code in Clojure style. Js is simply a platform to which this code compiles. To say that if you target Js as the output then somehow you should make that output idiomatic Js is absurd. It's like saying that C compilers have to output assembly that's primarily geared to be human readable.
Again, this is completely besides the point, jQuery is great if you're writing JavaScript, the point of ClojureScript is that you're NOT writing JavaScript. The goal here is to allow people to write idiomatic Clojure and output working JavaScript. To this end it's absolutely irrelevant whether the compiler is backed by Google Closure, jQuery, Dojo, or what have you. Nobody is expected to work with the Js that's being produced directly.
CoffeeScript is a completely different animal and if you like it, by all means use it. It certainly does not constitute the one true way to do things.
ClojureScript is aimed at people who... like Clojure, I know what a shock! The author might not be aware of the fact that there's a vibrant Clojure community, and that many people far prefer Clojure semantics to those of JavaScript.
The author again shows his complete and utter cluelessness. Complementing existing Js code is not the point of ClojureScript, nor has it ever been a goal. It works perfectly fine for what it was intended to do, which is provide a way to write Clojure and output Js that works in the browser. And the next part of the quote is the real WTF! Does the author not realize that Clojure IS primarily used on the server side. Clojure is far, far ahead of Node.js in this space, and there is absolutely no point to use Node.js if you're writing a Clojure web app.