6 ms·
ClojureScript: Things That Might Worry You, but Shouldn't (2012)
- joaomsa 13y agoI wanted to try out ClojureScript a while ago, but found the tooling around it very complex since I also didn't have any experience with Clojure and Leiningen. Is there a straightforward starter guide around?
- islon 13y agoIt used to be a PITA, it's still not perfect but much better. take a look at lein-cljsbuild (https://github.com/emezeske/lein-cljsbuild https://github.com/emezeske/lein-cljsbuild) to create you project, there you can just create an html and add the resulting js in the html, so you can test in the browser. No need for web servers or anything.
- ianbishop 13y agoModern CLJS does a pretty good job of guiding you through Clojurescript's tooling: https://github.com/magomimmo/modern-cljs https://github.com/magomimmo/modern-cljs
- smrtinsert 13y agoClojureScript Up and Running is actually pretty good. Lein I've gotten to know simply by using it, getting snippets from blogs here and there. Once I get better with it, I'm curious to see if I could use it for Java builds. It's the build tool Java ppl have been waiting for I think.
- dktbs 13y agoI'm going through "ClojureScript Up and Running" right now, and I'd also recommend it. However, for folks who just want to give cljs a try, lein-cljsbuild does make it pretty easy at this point. Once you have lein and the lein-cljsbuild plug-in installed, the basic information on how to get a project up and running is here: https://github.com/emezeske/lein-cljsbuild#just-give-me-a-damned-example-already https://github.com/emezeske/lein-cljsbuild#just-give-me-a-da... They also include example projects in the lein-cljsbuild repo that make use of some of the popular clojure web libraries like ring and compojure: https://github.com/emezeske/lein-cljsbuild/tree/master/example-projects/simple https://github.com/emezeske/lein-cljsbuild/tree/master/examp...
- jared314 13y agoPrevious Discussion: https://news.ycombinator.com/item?id=4505168 https://news.ycombinator.com/item?id=4505168
- swannodette 13y agoFor some deeper rationale of why ClojureScript over other neat compile to JS languages like CoffeeScript, Dart (via dart2js), and TypeScript check out a talk I gave recently at the Norwegian Developers Conference, ClojureScript: Lisp's Revenge http://vimeo.com/68334908 http://vimeo.com/68334908 I think the arrival of core.async makes ClojureScript an even more compelling option as it has the potential to eliminate an incredible amount of incidental complexity.
- adrianm 13y agoI'm already a big fan and advocate of both Clojure and ClojureScript, and although I've had great success convincing friends and coworkers to give Clojure a try (and even get excited about it), unfortunately ClojureScript has been a different animal entirely. Thus far, everyone I've taught Clojure concepts to really appreciates the functional bend of the language, immutable values, and of course the elegant sequence/collection abstractions/persistant data structures that Clojure provides. But semantics are almost never a convincing argument (for most for programmers I know) for spending the time to pick up another language. What really pushes people over the edge in my experience from thinking of Clojure as "just another Lisp" or a parentheses laden toy, are the amazing concurrency primitives that Clojure provides out of the box. Once my colleagues realize how trivial (and fun!) both concurrent and parallel computation becomes with Clojure, they're hooked and want to dive in. The talk you gave is probably the most concise manifesto I've yet to come across of just how much better Clojure's semantics are for, well, pretty much any complex problem I can think of. You did an absolutely fantastic job with your assemblage of example functions which definitely shows off the language. But I know that if I want to convince the company I work at to adopt ClojureScript as a JS replacement for our client side applications, an argument for superior semantics is almost never going to get very far. Clojure (in combination with libraries like Incanter, JVM interop, etc.) allows me to completely replace R & Python for both exploratory data analysis, machine learning, and building a powerful backend for any distributed application with a double whammy of awesome - I get a much better language for expressing a lot of ideas AND it's fast as hell. I can scale my Clojure code to a cluster of CPUs for training some model without a second thought. I can write really powerful software and never feel limited in what I can accomplish and in the end, project managers/execs just can't argue. Simply nothing else exists in this class with this combination of agility, functional elegance, and "enterprise" class power. Okay, this comment began as a thank you for making a great appeal for ClojureScript and has unexpectedly turned into... I'm not even sure. So, TLDR? We need a killer feature that goes beyond semantics for ClojureScript that fixes something broken and practical in JavaScript. Is this a seamless and powerful Web Workers VM or abstraction that just works? Is it a mature core.async in tandem with full featured promises? Is it a new core lib that makes having to think about client/server interaction a problem of the past? I just don't know.
- leishulang 13y agoI am expecting the author to mention the single most important factor that worries most cljs users: the interfacing problem with other JS libraries that cause by google closure compiler. But apparently he does not use other JS libs. And yes, we need Closure advanced compiled mode when ClojureScript ships with a standard library nearly 7500 lines long.
- swannodette 13y agoInterfacing with other JS libraries isn't really a problem - that has been relatively pleasant for a long time now (:foreign-libs compiler option allows you integrate arbitrary JS libraries). Also note that the most popular JS libraries like Underscore.js and jQuery add little value to ClojureScript given the rich standard library and pure ClojureScript solutions like Domina. Integrating with functional frameworks like Angular.js isn't too painful as evidenced by Weathertron - http://keminglabs.com/blog/angular-cljs-weather-app/ http://keminglabs.com/blog/angular-cljs-weather-app/
- smrtinsert 13y agoNot sure what angular buys you when the power of clj is available - way too low level imo. I wouldn't mind a cljs version of seesaw though, I don't think something like that is out there yet.
- swannodette 13y agoWasn't advocating or not advocating Angular, just addressing the question of interop.
- mullr 13y agoAngular is still a nice way to do your DOM manipulation declaratively. https://github.com/pangloss/clang https://github.com/pangloss/clang extends angular to work with the the built in clojurescript data structures. Or https://github.com/zcaudate/purnam https://github.com/zcaudate/purnam has some angular helpers that work with regular javascript objects.
- 13y ago
- tieTYT 13y agoI went into irc's #clojure to ask if I should use clojurescript for developing a html canvas based game. Most of the people in the chatroom dissuaded me. Their main concerns were: 1) there's no source maps. IE: a browser stack trace does not map exactly to your clojurescript code so it can make things hard to debug. 2) finding and fixing performance issues in your clojurescript would be very challenging, especially if you're not an expert in javascript already (which I'm not) I took their advice but a personal issue I had along the way was, where the hell is the "hello world" getting started guide!? I was never able to find documentation that said, "write this simple file and type this simple command and now you've just built your first clojurescript example". Keep in mind I cut my research short, but I did put at least 2 hours into it. So I decided to use coffeescript instead. I think it's closer to the raw javascript but it's more concise. I haven't had any performance issues and even though coffeescript is supposed to have source maps, I haven't needed to use them yet. It's giving me confidence to try clojurescript for my next project. I think it'll be an even better experience than coffeescript. The ability to write your program in one language, front and backend, is really appealing.
- swannodette 13y agoWe already had have rudimentary support for source maps - in fact it seems people have already used it to successfully debug their programs. It's not good enough yet for step-by-step debugging - we're getting there. This is a fantastic tutorial - http://github.com/magomimmo/modern-cljs http://github.com/magomimmo/modern-cljs RE: performance. I don't know who you talked to, but they are misinformed we spend a ridiculous amount of time on performance. It's certainly possible to do an HTML 5 canvas game in ClojureScript - http://swannodette.github.io/2013/06/10/porting-notchs-minecraft-demo-to-clojurescript/ http://swannodette.github.io/2013/06/10/porting-notchs-minec.... It is true that if you want to do a computationally intensive game you need to know something about JavaScript performance - but that's to be expected.
- tieTYT 13y agoThat tutorial link alone was worth me making my comment :) Yeah I feel comfortable trying clojurescript next time. Thanks for the info.