In this talk I watched, the speaker argues for ClojureScript for SPAs because it has: * an excellent standard library (great functional programming so no need for lodash or other hacks, no issues with things like map(Integer.parse), solid date support, etc) * Go-level easy concurrency * Immutable types built-in for a fast React experience (immutable.js by default) * built-in Google Closure Compiler for optimizing, (also with sourcemaps and devtools) * built-in tree-shaking (only import what you use) from Google Closure Compiler * built-in code-splitting (don't import the code for the settings page on the home page, automatically load it when the user goes there), also from Google Closure Compiler
And the talk is from 2015! So there's probably been even more added I don't know about yet.
Then again, in 2017 I feel like we have an embarrassment of riches of programming languages. I'm already playing around with Elixir (loving it), wanna try out Rust's zero-cost everythings, and have finally finishing learning Haskell on my back burner.
Literally just 'lein new figwheel' and you've got a project ready for everything you mentioned with hot reloading ready to go
I feel like Clojure needs a really good use case or story to have it become more popular. It feels really nice to program in, it's just that for specific needs - native UI programming, CLI apps, concurrent programming, data processing, web programming - other languages are better in those areas, and are good enough in other areas, that Clojure just doesn't seem compelling.
I think that Elixir's (which is really the same story as Ruby's) success is worth looking at. Elixir is really cool, but it's main hype train really doesn't have anything to do with it's technical strengths (concurrent programming) - it just has a really compelling web development story through Phoenix.
In what regard? Because the JVM is faster than all of the above.
So yeah, Clojure's faster, but perception matters. Erlang's a different case because it optimises for responsiveness for small tasks. It's very hard to write Clojure or even raw Java code as good at that as an easy Erlang program.
But yeah, a Mandelbrot set will be faster in Clojure.
That's why JRuby is still a niche and most developers keep using MRI despite JRuby being eventually faster. It's a different example of developer happiness.
Missed?
Yes.
Pick a thing.
Be excellent at it.
What is clojurescript excellent at?
Its a nice language, with not very nice tooling, that is hard to maintain and significantly different from the existing javascript code base you already have, with poor interop to the existing js ecosystem (it is poor, compared to some other compile to js languages).
On the JVM, java sucks, but your choices are limited; what, maybe groovy, kotlin, scale, clojure?
Clojure has pride of place as the best dynamic language in that space.
For javascript, that crowd of alternatives is so much larger, clojurescript needs to actually be good to stand out amongst all the others.
...and I don't think it really does.
The people who use it seem to just like it as a language; and I get that, that's a thing.
...but aesthetics are personal preference and its difficult to ague they make a compelling use case.
The tooling is the best. Figwheel is hot reload that never goes down, devcards is revolutionary, and a browser repl for live in editor evaluation...
> significantly different from the existing javascript code base you already have
It actually isn't. Clojurescript is basically javascript that's immutable first, has underscore in it's core library, and then a bunch of other awesome language constructs. The libraries use the same patterns, re-frame is a nicer, more succinct abstraction over react-redux.
> poor interop to the existing js ecosystem
The interop might be the best out there. Seriously you can write javascript in clojurescript. you can straight up import es6 jsx javascript into your clojurescript code. (thanks Google Closure)
> For javascript, that crowd of alternatives is so much larger
I mean, what are the options? Clojurescript's benefits are so much more than the language. The real pluses for clojurescript are the Google Closure compiler, hot reload, browser repl, devcards, front end libraries. The language is the cherry on top. There are no alternatives that have a comparable platform not completely alien to JS developers.
But I do like Clojurescript. However, it needs to wean itself away from the all the Java tooling and not require a JDK. We need a lein/figwheel written in node CLJS. An extension that supports REPL like Lumo and step through debugging within visual studio code. A good Clojurescript book. A good React-based UI component library written in CLJS.
No, it's really not.
Have you tried other ecosystems? You should. If clojure is the best tooling you've ever used, look around, there's a wide world out there.
Heck, even the article linked above from lambdaisland lists tooling as one of the issues clojure suffers with.
> I mean, what are the options?
Haxe. Dart. Typescript. Elm. Scala. LivesSript. ES6. CoffeeScript. Flow. PureScript. ...
There must be what, 50 odd listed on https://github.com/jashkenas/coffeescript/wiki/List-of-langu...
...but I mean, even if we accept that the things you say about clojurescript are true (and I don't agree that they are, but even if I did), the point I'm making is that it doesnt stand out from the crowd in terms of features.
Nothing you've described is something that would be missed particularly using say, typescript, webpack and npm.
ClojureScript excels when writing frontend UIs, in my opinion. There are so many good ideas in Reagent and Re-Frame. JS tries to be like Re-Frame, with Immutable.js, react-redux, etc.
(the clojurescript is now considered 'legacy')
Yes. The only other JVM dynamic language in your list is Apache Groovy. Last month it released version "2.5-alpha-1" with Groovy's very first macro facility, something Clojure's been doing since its inception. And I can't imagine how long a version tagged "alpha-1" will take to be suitable for actual use!
For the JS developers out there, is this something that's of interest? Or is the existing tooling(lein) good enough? What would be your ideal tooling story?
Sounds like I should revisit CLJS based on your comment.
That said, Figwheel hooked up with atom+protorepl+parinfer is pretty amazing if you haven't tried it.
With a strong statically typed language like scalajs or elm, you have a lot more static reasoning that can be done at compile time, allowing you to omit a lot of runtime support.
[0] http://www.lihaoyi.com/post/FromfirstprinciplesWhyIbetonScal...
Having tried both I really prefer mori, mori imports some core clojure functions with it. I found working with iterators which was recommended with immutable.js very awkward.