There’s the send to repl functions. And there’s the eval functions.
The send to repl functions are like if you copy/pasted things in the REPL window and pressed enter. So they are executed in the context of your REPL window. So if you send some defn form it will just send that. It won’t send anything else.
The eval functions evaluate the form within the context of the first ns form found backward from the form you are evaluating. So if you evaluate some defn and above the defn you have (ns foo) and your REPL window is in the user namespace, Cider will switch to foo and evaluate the defn, but it’s not switching your REPL window, in the REPL window you are still going to be inside the user namespace.
The output of the send to repl functions will show in the REPL window.
The output of the eval functions will show inline with the code.
Yes, forms in an ns are evaluated in that ns, but the ns form itself is not evaluated if you don’t do it explicitly (so requires and imports are not available until you do)
Ya, I don’t remember what it does exactly, I had looked it up a while ago. I think it might just call in-ns or maybe it just binds*ns*. If it does the former, it would create the namespace if it didn’t exist, but otherwise would just switch to it without requiring or importing anything.