On Sep 11, 2012, at 4:00 AM, Laurent PETIT wrote: > 2012/9/10 Chas Emerick <c...@cemerick.com> > I've been using a combination of lein-cljsbuild to keep the on-disk generated > code fresh and piggieback[1] for all of my cljs REPL needs. > > Hello Chas, > > I've tried to use piggieback. My current stack for playing with the concepts > is leiningen2 on the command line (to start the server), with clsjbuild to > compile the browser_repl.cljs to "bootstrap" the REPL machinery (lein > cljsbuild once), regular "lein repl" once project.clj has been configured > with the proper options) and a regular CCW 0.10.0 nrepl client. > > It works OK with the "out of the box" Rhino-backed evaluator, but as you > might guess, I have no interest in this and then I quickly jump to try & get > a Browser-based REPL running. > > That's where things broke. > I did not manage to get things compiled correctly. > > As it stands, it seems that I'll have to read & understand wiki pages from > ClojureScript project, nrepl documentation, piggieback documentation, > cljsbuild documentation, to really grasp the whole thing. > Seems a little bit daunting just to be able to "play" with it. Is there an > easier way ? A resource somewhere which already explains step-by-step how to > get started with a new project, cljsbuild for compiling from time to time, > and piggieback ? > > Just asking before starting digging :-)
There is a how-to in piggieback's README for using a browser-repl environment rather than Rhino. Nelson Morris was actually the first one to get that working, and I'm using it regularly, so it *does* work, though there's no doubt there's a lot of pieces you need to put together (for my part, I blew nearly an hour tearing my hair out before re-reading the browser-repl tutorial,[1] and seeing near the bottom that loading the HTML page from disk wouldn't work; once I served the page from localhost, everything fell together). FWIW, I've found ClojureScript itself to be very solid so far; there are some unfortunate (IMO unnecessary) incompatibilities between it and Clojure, but [2] is the only thing I've really tripped up on from a technical standpoint. I think your assessment that the learning curve is "daunting" is just about right, but that largely lays with the state of tooling, and the disjointed nature of the development process. With Clojure, you always have a single environment (the JVM or CLR), into which you can load code all day from nearly anywhere without having to think much about the logistics of it. ClojureScript necessarily implies a more complicated setup: there's your REPL environment, probably a browser, and maybe a connection between the two; you *must* have your code on disk and in the right place in order for Google Closure / lein-cljsbuild to get at it (not strictly true, but driving the compiler from a Clojure REPL isn't any easier outside of simple cases); your Ring webapp needs to be configured to be serving the gclosure output; and, you'd obviously like to be able to control and monitor all of this from your editor/environment of choice. (I'd like to eventually do a 'Starting ClojureScript' screencast similar to [3], but the logistics of "going from zero to hero" with ClojureScript are IMO far too hard and nuanced still in order to present them well in that sort of medium.) I think the contrast is so stark in part because of how good we've had it on the Clojure side. I suspect that CoffeeScript programming must be similarly disjointed, since all the same moving pieces are necessary (and perhaps without the benefit of upsides like a browser-connected REPL and so on). Welcome to the wonderful world of modern web development! :-P I think that's all a long way of saying: start digging! Cheers, - Chas [1] https://github.com/clojure/clojurescript/wiki/The-REPL-and-Evaluation-Environments [2] http://dev.clojure.org/jira/browse/CLJS-358 [3] http://cemerick.com/2012/05/02/starting-clojure/ -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en