Hacker News new | past | comments | ask | show | jobs | submit login

ClojureScript supports a feature called Browser REPL. The compiler REPL compiles your code to JS and sends it to the browser for evaluation which sends the result back. This means you can develop w/o restarting the browser or ever leaving your source file while incrementally developing your project.

At the moment it works best in Emacs, but people are starting to add support for other development environments.

After developing JS this way going back is simply painful.




Is the only difference between the ClojureScript REPL and Firebug/WebInspector (for JS) that I get to keep using my editor? I mean, you can already do JS at the REPL without reloading the page.

fwiw, I'm an Emacs user, Lisp geek, and huge Clojure fan. I see the benefit of this, I'm just curious if not leaving my editor is the only advantage or if I'm missing something else.


I dunno, IME, refreshing the browser to test small changes is a massive time sink.


I think you misunderstood. I can already pull up a REPL (that's running code on the current page) and write/paste as much JS as I like into it without ever refreshing.

So is the fact that you get to stay in Emacs the main selling point? Like I said, I'm just trying to understand.


Yeah, I think you're right, the REPL itself isn't revolutionary, although I felt as enthusiastic as the op when I discovered it existed. Then I tried to use it.

It's alpha quality, breaks and has to be restarted quite often. And a large part of webapp dev is testing code that is inaccessible from the global scope because of architecture (module pattern, etc). There is some magic however for dynamically loading Google Closure Library code that it wasn't compiled with, but I found setting up correct paths to include my own ClojureScript files to be tricky, especially doing so when targetting platforms with their own particular architectures (eg CouchDB/Couchapps).

That said, I think the op made a very good point about ClojureScript producing code that one would never write by hand. It's really the Clojure/Lisp idioms that are the win. The REPL an accessory, and a nice one, even moreso once the rough edges have been smoothed over.


You can switch namespaces by eval'ing the ns form in your file after starting the REPL. Agreed there are lots of rough edges. But even with those I am able to code / test faster than w/ plain JavaScript or CoffeeScript.


There are definitely rough edges, but the potential is immense. By the way, a recent patch stops alot of the break->restart issues (specifically, syntax errors don't boot you out anymore).


He was also comparing to CoffeeScript, and sadly there's no way to do it there. This is the one feature that keeps me from using CoffeeScript, the lack of REPL integration--I have no idea how other people do without MozRepl or SwankJS or something homegrown. If I don't have something akin to Slime for emacs, it really frustrates me. I assume I'm not that smart or extra lazy.

I question your use of "only" able to use your own editor. There are myriad problems with using Firebug to write your code in: It doesn't save your code so if the browser crashes or hangs (which happens all too much with my installation of Firefox) you lose it; if Firebug starts behaving wonky (again, happens all the time) you lose it; you have to copy and paste the code into your editor once it's done; and, the editing mode itself is awful, of course. This is, as opposed to, say, MozRepl, which is instead convenient and safe. I assume the ClojureScript environment is as nice or nicer.


1) Function is wrong

2) Fix function in source file

3) Send updated function to browser

No clicking around, no copy and pasting.


FWIWI, it's pretty trivial to set up hooks in Emacs to automatically refresh a page after you save each JS file. Or better yet, send it straight over the wire via MozRepl. I find "massive time sink" a bit hard to take seriously.


MozRepl can give you a JS repl in emacs tied into the browser...no refresh required: https://github.com/bard/mozrepl/wiki


MozRepl has many usability problems not least of which is being specific to Firefox. Browser Repl works in every browser.


You're referring to Chris Granger's project; https://github.com/ibdknox/brepl ?


No, ClojureScript now has its own browser REPL.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: