ClojureScript REPL Changes

Showing 1-2 of 2 messages
ClojureScript REPL Changes Brenton 10/3/11 7:11 AM
Several improvements have been made to the ClojureScript REPL.

In ClojureScript, the method of printing output will be different for
each evaluation environment. There is now a var named *print-fn* in
cljs.core which will need to be explicitly set to a function that can
print in the target environment. If you would like to ignore all
printed output you could do this:

(set! *print-fn* (constantly nil))

The print function that you specify takes one argument, the value to
be printed. What you do with that value is totally up to you and your
environment. Sane defaults are set when running the REPL with Rhino or
the browser.

We are now using Rhino version 1.7R3 instead of whatever version of
Rhino is bundled with Java. This provides the following benefits:

* better error messages
* nice JavaScript stacktraces
* it's faster
* it isn't tied to a particular VM (should fix the problems people
were seeing on OpenJDK)

You will need to rerun script/bootstrap to download the Rhino jar and
install it in your lib folder. Windows people will need to do this

For the browser-connected REPL, we can now print to the REPL. This
means that the browser-connected REPL works exactly like an old-
fashioned Clojure REPL.

For example, you can now do this:

ClojureScript:cljs.user> (time (reduce + (range 1000)))
"Elapsed time: 222 msecs"

If your application is printing things while running then this printed
output will be printed in the REPL. Of course, you can set the *print-
fn* to do whatever you like.

Finally, when using Chrome and Firefox for evaluation, you will now
see JavaScript stacktraces in the REPL.

If you have been using the browser-connected REPL then you will need
to delete the .repl folder before using the new changes.
Re: ClojureScript REPL Changes David Nolen 10/3/11 7:25 AM
I've been playing with the changes for the past few days. Huge improvement. Thanks for all this!


You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
For more options, visit this group at