Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

Just to report that the following does not work at the repl (in Clojure it does):

`
(ns first.namespace)
(def a 4)
(ns second.es)
(require 'first.namespace) ;; with :reload is the same
java.lang.IllegalArgumentException: Namespace first.namespace does not exist

at cljs.closure$source_for_namespace.invoke(closure.clj:605)
at cljs.repl$load_namespace.invoke(repl.cljc:182)
at cljs.repl$load_dependencies.invoke(repl.cljc:206)
at cljs.repl$evaluate_form.invoke(repl.cljc:474)
at cljs.repl$fn__4470$self__4482.invoke(repl.cljc:673)
at clojure.lang.AFn.applyToHelper(AFn.java:165)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:630)
at cljs.repl$wrap_self$g__4450.invoke(repl.cljc:630)
at cljs.repl$repl_STAR_$read_eval_print__4536.invoke(repl.cljc:854)
at cljs.repl$repl_STAR_$fn__4542$fn__4551.invoke(repl.cljc:895)
at cljs.repl$repl_STAR_$fn__4542.invoke(repl.cljc:894)
at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1146)
at cljs.repl$repl_STAR_.invoke(repl.cljc:858)
at cljs.repl$repl.doInvoke(repl.cljc:976)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at cljsbuild.repl.rhino$run_repl_rhino.invoke(rhino.clj:8)
at user$eval4946.invoke(form-init5490341798700416710.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6782)
at clojure.lang.Compiler.eval(Compiler.java:6772)
at clojure.lang.Compiler.load(Compiler.java:7227)
at clojure.lang.Compiler.loadFile(Compiler.java:7165)
at clojure.main$load_script.invoke(main.clj:275)
at clojure.main$init_opt.invoke(main.clj:280)
at clojure.main$initialize.invoke(main.clj:308)
at clojure.main$null_opt.invoke(main.clj:343)
at clojure.main$main.doInvoke(main.clj:421)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)

`

I am available for investigating more and/or taking charge of the issue.

5 Answers

0 votes
by

Comment made by: arichiardi

sorry about the mistakes...how to edit?

0 votes
by

Comment made by: arichiardi

Confirmed using NodeJs repl:

`

ClojureScript Node.js REPL server listening on 51885
Watch compilation log available at: out/watch.log
To quit, type: :cljs/quit
cljs.user=> (in-ns 'ns.core)
nil
ns.core=> (def a 3)

'ns.core/a

ns.core=> (in-ns 's.core.repl)
nil
s.core.repl=> (require 'ns.core)
java.lang.IllegalArgumentException: Namespace ns.core does not exist

at cljs.closure$source_for_namespace.invoke(closure.clj:605)
at cljs.repl$load_namespace.invoke(repl.cljc:182)
at cljs.repl$load_dependencies.invoke(repl.cljc:206)
at cljs.repl$evaluate_form.invoke(repl.cljc:474)
at cljs.repl$fn__4583$self__4595.invoke(repl.cljc:673)
at clojure.lang.AFn.applyToHelper(AFn.java:165)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:630)
at cljs.repl$wrap_self$g__4563.invoke(repl.cljc:630)
at cljs.repl$repl_STAR_$read_eval_print__4649.invoke(repl.cljc:854)
at cljs.repl$repl_STAR_$fn__4655$fn__4664.invoke(repl.cljc:895)
at cljs.repl$repl_STAR_$fn__4655.invoke(repl.cljc:894)
at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1146)
at cljs.repl$repl_STAR_.invoke(repl.cljc:858)
at cljs.repl$repl.doInvoke(repl.cljc:976)
at clojure.lang.RestFn.invoke(RestFn.java:486)
at user$eval44.invoke(node_repl.clj:10)
at clojure.lang.Compiler.eval(Compiler.java:6782)
at clojure.lang.Compiler.load(Compiler.java:7227)
at clojure.lang.Compiler.loadFile(Compiler.java:7165)
at clojure.main$load_script.invoke(main.clj:275)
at clojure.main$script_opt.invoke(main.clj:337)
at clojure.main$main.doInvoke(main.clj:421)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:379)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)

`

0 votes
by

Comment made by: arichiardi

I guess it is each repl-env with its -evaluate to be responsible for loading right? Can it be a proble of each and every **load-fn** out there?

0 votes
by
_Comment made by: arichiardi_

I am analyzing `cljs.repl/load-namespace` and it looks like it handles only loading from sources:


line 178 @ clojurescript 1.7.158

 sources (cljsc/add-dependencies
                   (merge (env->opts repl-env) opts)
                   {:requires [(name ns)]
                    :type :seed
                    :url (:uri (cljsc/source-for-namespace
                                 ns env/*compiler*))})



The function `cljs.closure/source-for-namespace` is throwing the exception because of course it cannot find the sources for a manually created namespace.
An idea could be to change `cljs.closure/source-for-namespace` and return nil in case no sources can be found.
Then change `cljs.repl/load-namespace` to check for created namespaces when `souces` is nil.

Mike told me that the namespaces are not reified, so the next question is, is there an atom that contains all the created namespaces?

I am going to wait for input on this, when everybody has time of course.
0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-1473 (reported by arichiardi)
...