3 ms·
No thread on HN would be complete without the JavaScript programmer jumping in to "well actually" your response, so I formally nominate myself to fill that role
by bastawhiz 8y ago
No thread on HN would be complete without the JavaScript programmer jumping in to "well actually" your response, so I formally nominate myself to fill that role. ECMAScript is getting pattern matching! It's currently a stage 1 proposal with backing from Microsoft, npm, and Facebook.
https://github.com/tc39/proposal-pattern-matching https://github.com/tc39/proposal-pattern-matching
- Scarbutt 8y agoI was researching clojure vs nodejs for a webapp, but found that the benefits clojure provides are very small and not enough compared to the benefits you get with JS the ecosystem. And Javascript 2019 is actually nice.
- jwr 8y agoThe usual problem with such comparisons is that in order to understand the benefits of Clojure/ClojureScript, you have to use those tools to write a reasonably large system. Otherwise the comparisons are superficial. The other problem is that most comparisons are apples-to-oranges. Does core.async sound kind-of-like async/await? Write a checkmark in a comparison table and move on. But reality is nothing like it. Every time I have to write some JavaScript (interop) code, I am amazed that people put up with all the incidental complexity. I mean, just recently I had to implement three different ways of accessing data which was essentially in an array. Three various pieces of imperative code with iteration. In ClojureScript that would have been zero code, because everything that is "array-like" can be accessed as a seq. That sort of thing does not come up in superficial comparisons.
- Scarbutt 8y agoI agree, Clojure is technically superior in almost every way when compared to JS IMO, and would much prefer to write Clojure than JS. My poor formulated point was that, sometimes the ecosystem is more important. An experienced dev that already knows how to do everything in the domain he's working on won't have much trouble with Clojure, but you don't always know how to do some things and this is were ecosystem(third party APIs, docs, books, libs, forums, etc...) helps greatly. Also for Clojure and Clojurescript you need to at least have some good level read proficiency in Java and Javascript.
- amelius 8y agoThat's interesting, but makes me wonder: how does this spec cover these cases: - select for a map with key "a" and not "b" - select for a map with key "a" and possibly "b" - select for a map with key "a" and possibly any other key.
- bastawhiz 8y agoIt's the first step into pattern matching, so I'm not surprised that it isn't as complete as other languages' implementations. But even without further language modification, I'd bet there are some tricksy things you could do to replicate that behavior. As the saying goes, "JavaScript finds a way"