

ClojureScript gets a REPL that drives the browser - ibdknox
https://github.com/ibdknox/brepl

======
johnfn
I had been wondering about what advantage ClojureScript gave, since the
biggest appeal of lisp to me is generally the ability to send functions
straight to the REPL and see updates without restarting the program. Last
night, I went on IRC to ask about this, and lbdknox responded that he was
working on it as I asked. As he explained a little more, I realized that it
wasn't an intractable problem - in fact, I was capable of solving it.

I think the lesson here is that you shouldn't just wait for answers to your
problems - you should create them.

~~~
devin
Stolen from Alan Kay: "Don't worry about what anybody else is going to do. The
best way to predict the future is to invent it." --Alan Kay

Stolen from "Joy of Clojure": CLOJURE APHORISM Clojure programmers don’t write
their apps in Clojure. They write the language that they use to write their
apps in Clojure. --M. Fogus && C. Houser

------
nkassis
I've been wondering why they didn't create an actual compiler in javascript? I
understand it's more trouble.

~~~
JoelMcCracken
I imagine that they would have, but for the following:

I'm sure that clojure compiles clojure, at this point, at least for the
majority.

So, once you've written something that compiles clojure to js, then you just
need to compile that compiler to js.

Why haven't they done this? My guess is that "something" in the clojure
compiler relies on the jvm, or links to some java code to do its work.

Another possible reason that clojurescript doesn't yet compile all valid
clojure.

In any case, I'm sure that this is an eventual goal. Hickey has stated that he
always wanted clojure to target multiple platforms, but decided to start on
java first.

------
ithayer
Any good examples of some JS that's cool to run?

~~~
ibdknox
Not "cool" per se, but here's something that works :)

    
    
        (require '[goog.dom :as dom])
        (def body (aget (dom/getElementsByTagNameAndClass "body") 0))
        (defn elem-factory [tag text] 
            (let [elem (dom/createElement tag)] 
                (dom/setTextContent elem text) 
                elem))
        (dom/appendChild body (elem-factory "p" "my new tag"))

------
vishgm
Will ClojureScript take care of cross-browser issues?

~~~
nickik
ClojureScript just compiles to JavaScript it does not care for cross-browser
issues --> it does not add a browser independed standard library but
ClojureScript works closly together with the Google Closure library (witch is
used for a lot google products) and this library includes browser independend
librarys.

~~~
vishgm
ok. thanks

