Fork me on GitHub
#nrepl
<
2023-04-13
>
bozhidar07:04:02

@pez It does this only for the initial namespace, which is usually user.

bozhidar07:04:47

No one has complained, so I can only hope this works fine. 😄

pez07:04:23

I think it could partly be because there is seldom much reason to use those utilities directly when in an environment like CIDER. To me, I seldom spend much time in the user namespace so having the utilities available only there wouldn’t bring me much joy. Anyway, I implemented the same default in Calva now. It could get weird with some namespaces to have it always happen. https://clojurians.slack.com/archives/CBE668G4R/p1681337488164959

bozhidar07:04:31

Indeed. When add-lib is part of Clojure I guess CIDER and Calva will just provide wrappers for working with it, so I doubt many people will have to use it directly in the REPL.

Alex Miller (Clojure team)14:04:24

one common style of working is to leave your interactive repl in user but eval from the editor most of the time - I do that in Cursive and Calva

Alex Miller (Clojure team)14:04:57

Some people actually work entirely in user, but I'm not sure that's very common :)

pez14:04:30

Your interactive repl being started outside Calva, I take it?

pez14:04:54

The interactive REPL is the output/repl window? I can’t make that stay in user as I evaluate things in various files. What am I missing here? 😃

Alex Miller (Clojure team)14:04:15

maybe I use it so infrequently that I'm imagining it :)

😂 2
Alex Miller (Clojure team)14:04:33

this is the peril of using multiple editors all the time

pez14:04:17

So, essentially, Calva makes that workflow impossible, because of the convenience of helping you switch namespace. I wonder if we should fix that…

Alex Miller (Clojure team)15:04:32

I'm not asking for anything :)

pez15:04:27

Not saying you are. It is more that I just became aware of a workflow I have shut down. 😃 Not that I think Calva needs to support all workflows, and this one is supported if you start an interactive REPL in a terminal and connect to it. Jack-in is convenience, after all. But anyway, I prefer to take such decisions consciously.

cfleming22:04:18

So if I understand correctly, when you eval in a REPL from an editor, does Calva switch the ns for that REPL before evaluating? Cursive binds *ns* dynamically for the scope of the eval, so only the single form sent from the editor is in that ns, and the REPL stays where the user left it.

pez22:04:57

Yes. Calva switches the ns of the REPL. It has not always done this, but at some point that was what most people did manually anyway.

cfleming22:04:05

FWIW I think dynamically binding is a really nice experience 🙂

pez22:04:46

I think in Calva it mostly doesn’t matter. Users don’t fiddle around at the REPL prompt much. Once I get around to replace the prompt with a web view I think it’ll open up for other ways to make it clear in which ns something was evaluated and we can switch back to letting the prompt stay in whatever ns the user left it.

cfleming22:04:25

I’m a bit late to this, but Cursive does require repl-requires if it exists.