Referred vars in a namespace are only available after a (load-file)
To reproduce:
- Run
lein cljsbuild oncein the example project. - Open a REPL in the example project.
- Open
index.htmlin a browser. - Switch to the
weasel-example.exampleNS, and evaluatebaz.
The referred var will not be available.
Then, run (load-file "weasel_example/example.cljs"), and try to evaluate baz again. The referred var will be available, and its value will be printed.
Technically I would not consider this a bug, but you may wish to preserve pre-existing behavior. You will need to analyze a source directory for these things to be available, :cache-analysis will definitely help here if you want to incur small overheads.
@tomjakubowski FWIW, Ambly exhibits what appears to be similar behavior. You can see this in the README.md instructions for Shrimp (where a require is used in lieu of a load-file to the same effect).
I actually get a WARNING: Use of undeclared Var but with things actually working, unless a require or load-file is first issued. (That's why I said similar behavior. If this is also what you are seeing then it is identical behavior.)
I found that issuing a repl/analyze-source call fixes this, but introduces the challenges I mentioned in #28 where there doesn't appear to be a way to programatically enumerate the source directories that need to be analyzed, and even if it were possible (say by introducing yet another :source-paths), they would need to be in a topological sort reflecting the dependency relation between the source directories.
autogenerated with https://github.com/MalloZup/doghub: issue inactive since 450 days. Please update the issue or close it