Fork me on GitHub

Hi there, I was asking a few things here a week ago. I understand now that you're not meant to manually switch namespaces in ProtoREPL. And it seems to work if I evaluate some block, then my REPL on the right hand side gets automatically switched into that namespace. But it seems that my namespace requires don't get executed. For instance, if I have already required clojure.pprint in my ns declaration, then I evaluate a function that uses pprint/pprint, I'll get an error when evaluating the block, because pprint/pprint won't be defined. Same for anything that's in require.


i.e., it seems that text sent to the REPL isn't compiled in the context of the namespace that it was sent from. Is that expected, or is it some sort of misconfiguration on my end?


You need to eval the (ns …) block at least once.


My dev workflow is to eval the whole file once when I first start editing it, and then just eval the block that I’m working on each time I make a change. Eval of the file requires no unsaved changes (so it’s easy to do as soon as you open a file), then eval a block can be done without saving first so it’s a nice, fast workflow.


If you update the (ns …) block (to add more requires etc), just eval that block again to get the changes picked up in the REPL.


Also, if you’re using Boot, rather than Leiningen, it’s easy to add new dependencies without restarting the REPL (in the REPL, switch to the boot.user ns and then (merge-env! :dependencies '[[ “RELEASE”]]) (or whatever specific version you want).