nrepl / weasel

ClojureScript browser REPL using WebSockets
The Unlicense
324 stars 35 forks source link

Referred vars in a namespace are only available after a (load-file) #48

Open tomjakubowski opened 9 years ago

tomjakubowski commented 9 years ago

To reproduce:

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.

swannodette commented 9 years ago

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.

mfikes commented 9 years ago

@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.

MalloZup commented 5 years ago

autogenerated with https://github.com/MalloZup/doghub: issue inactive since 450 days. Please update the issue or close it