Fork me on GitHub
#protorepl
<
2017-04-05
>
amoe15:04:49

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.

amoe15:04:03

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?

seancorfield17:04:47

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

seancorfield17:04:05

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.

seancorfield17:04:48

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.

seancorfield17:04:53

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 '[[my.new/library “RELEASE”]]) (or whatever specific version you want).