I wanted to use functions from _goog_ namespace although--as I found out later, I didn't have to because _goog_ is already exists in my namespace. So, I put (:require [goog]) in a ns declaration. Then, when I tried to reload that particular namespace by doing {{:require}} {{:reload}} in a cljs repl, I got:
bq. Error: Namespace "x.x.x" already declared.
Doing :require :reload again in the cljs repl makes the repl throws
Error: Namespace "cljs.user" already declared.
(NO_SOURCE_FILE)
(out/goog/base.js:273:40)
I tested the steps below using clojurescript *1.7.145* and *1.7.170*.
Here are the steps to reproduce which are taken from clojurescript quickstart-browser repl section:
1. Download the standalone clojurescript 1.7.170 jar
https://github.com/clojure/clojurescript/releases/download/r1.7.170/cljs.jar
2. Create a directory hello_world and copy the JAR into that directory, then from inside the hello_world directory:
mkdir -p src/hello_world;touch repl.clj;touch index.html;touch src/hello_world/core.cljs
3. repl.clj content
(require 'cljs.repl)
(require 'cljs.build.api)
(require 'cljs.repl.browser)
(cljs.build.api/build "src"
{:main 'hello-world.core
:output-to "out/main.js"
:verbose true})
(cljs.repl/repl (cljs.repl.browser/repl-env)
:watch "src"
:output-dir "out")
4. index.html content
<html>
<body>
<script type="text/javascript" src="out/main.js"></script>
</body>
</html>
5. src/hello_world/core.cljs content
(ns hello-world.core
(:require [clojure.browser.repl :as repl]))
(defonce conn
(repl/connect "http://localhost:9000/repl"))
(enable-console-print!)
(println "Hello world!")
(defn foo [a b]
(+ a b))
6. run clojurescript repl
java -cp cljs.jar:src clojure.main repl.clj
7. Open http://localhost:9000 in browser (I use google chrome). Open javascript console.
8. enter expression below in the clojurescript repl
(require '[hello-world.core :as hello] :reload)
10. Look the browser javascript console. Nothing new shown.
11. Quit from the repl using {{:cljs/quit}}
12. Add [goog] in ns declaration in {{src/hello_world/core.cljs}} so that the content of the file becomes:
(ns hello-world.core
(:require [clojure.browser.repl :as repl]
[goog]))
(defonce conn
(repl/connect "http://localhost:9000/repl"))
(enable-console-print!)
(println "Hello world!")
(defn foo [a b]
(+ a b))
13. Run the clojurescript repl again
java -cp cljs.jar:src clojure.main repl.clj
14. Now refresh the http://localhost:9000 in browser. Make sure the javascript console stays open.
13. enter expression below in the clojurescript repl
(require '[hello-world.core :as hello] :reload)
;;=> nil
it just returns nil
15. See the javascript console, it shows
Uncaught Error: Namespace "hello_world.core" already declared.
16. Executing this expression again (require '[hello-world.core :as hello] :reload) shows nothing new in the browser's javascript console while the clojurescript repl throws
Error: Namespace "cljs.user" already declared.
(NO_SOURCE_FILE)
(out/goog/base.js:273:40)