            (= form :cljs/quit) :quit
            
            (and (seq? form) (= (first form) 'in-ns))
-           (do (set! *cljs-ns* (second (second form))) (recur))
-
+           (do (set! *cljs-ns* (second (second form))) (newline) (recur))
+
+           (and (seq? form) ('#{load-file clojure.core/load-file} (first form)))
+           (do (load-file jse (second form)) (newline) (recur))
+           
            :else
-           (let [ret (try
-                       (let [ast (analyze (assoc env :ns (@namespaces *cljs-ns*)) form)
-                             js (emits ast)
-                             ret (.eval ^javax.script.ScriptEngine (:jse repl-env) js)]
-                         ret)
-                       (catch Throwable ex
-                         (.printStackTrace ex)))]
+           (let [ret (eval1 jse (assoc env :ns (@namespaces *cljs-ns*)) form)]
              (prn ret)
              (recur))))))))
 
 (comment
 
+;;the new way - use the REPL!!
 (require '[cljs.compiler :as comp])
 (def jse (comp/repl-env))  
 (comp/repl jse)
-
+(+ 1 2)
+(in-ns 'cljs.core)
+;;hack on core
+
+
+;;OLD way, don't you want to use the REPL? 
 (in-ns 'cljs.compiler)
 (import '[javax.script ScriptEngineManager])
 (def jse (-> (ScriptEngineManager.) (.getEngineByName "JavaScript")))

;;todo - move to core.cljs, using js
(def ^String bootjs "
//goog.provide should do this for us
cljs = {}
cljs.core = {}
cljs.user = {}
cljs.core.truth_ = function(x){return x != null && x !== false;}
cljs.core.fnOf_ = function(f){return (f instanceof Function?f:f.cljs$core$Fn$invoke);}")


  (let [jse (-> (javax.script.ScriptEngineManager.) (.getEngineByName "JavaScript"))
        base (io/resource "goog/base.js")]
    (assert base "Can't find goog/base.js in classpath")
    (.put jse javax.script.ScriptEngine/FILENAME "goog/base.js")
    (with-open [r (io/reader base)]
      (.eval jse r))
    (.eval jse bootjs)
    {:jse jse}))

(defn repl
  "Note - repl will reload core.cljs every time, even if supplied old repl-env"
  [repl-env]
  (prn "Type: " :cljs/quit " to quit")
  (binding [*cljs-ns* 'cljs.user]
    (let [jse (:jse repl-env)
          env {:context :statement :locals {}}]
      (load-file (:jse repl-env) "cljs/core.cljs")
      (loop []
        (print (str "ClojureScript:" *cljs-ns* "> "))
        (flush)
