            [org.mozilla.javascript Context ScriptableObject]))
 
 (def current-repl-env (atom nil))
-(def loaded-libs (atom #{}))
 
 ;;todo - move to core.cljs, using js
 (def ^String bootjs (str "goog.require = function(rule){"
                          "Packages.clojure.lang.RT[\"var\"](\"cljs.repl.rhino\",\"goog-require\")"
-                         ".invoke(rule);}"))
+                         ".invoke(___repl_env, rule);}"))
 
 (defprotocol IEval
   (-eval [this env filename line]))

;; You must not remove this notice, or any other, from this software.

(ns cljs.repl.rhino
  (:refer-clojure :exclude [loaded-libs])
  (:require [clojure.string :as string]
            [clojure.java.io :as io]
            [cljs.compiler :as comp]

                        "<cljs repl>"
                        '(set! *print-fn* (fn [x] (.print js/out x))))))

(defrecord RhinoEnv [loaded-libs]
  repl/IJavaScriptEnv
  (-setup [this]
    (rhino-setup this))
