nrepl

oyakushev 2024-09-06T11:51:43.110009Z

A question to everyone who uses nREPL – would you say it was reasonable if nREPL enabled *warn-on-reflection* by default for all code evaluated in the REPL session? I see a couple of pros and cons already but I would also love to hear what others think.

👍 3
mkvlr 2024-09-06T12:02:03.231699Z

I think I wouldn’t want that. I only enable it in namespaces where it matters, most of the code I work on isn’t performance critical so I don’t care and wouldn’t want the warnings to fill up my repl buffer. Though, to be fair I hardly ever look at the repl output so it also wouldn’t be a huge bother.

✅ 3
2024-09-06T12:17:36.919769Z

I also wouldn't want that for all projects, I feel it will be annoying, also when experimenting with things where perf doesn't matter. But would be great to be able to toggle it for some projects, via some JVM prop or something?

oyakushev 2024-09-06T12:20:44.353719Z

Yeah, I think about adding it as nREPL server config option (https://nrepl.org/nrepl/usage/server.html#server-configuration) but wonder if there were arguments for making it a default.

❤️ 2
2024-09-06T13:24:30.900589Z

if it's not the default for clojure, then it shouldn't be the default for nrepl. it'll cause confusion and annoyance

dominicm 2024-09-08T10:49:35.399849Z

Is the problem that using set! on it from an nrepl doesn't quite do what you might expect?

oyakushev 2024-09-08T12:20:53.510949Z

Well, it should. What exactly is wrong when you set! it?

dominicm 2024-09-08T12:23:34.131679Z

It does, as long as you're using the same session in multiple places, etc.

dominicm 2024-09-08T12:23:49.621929Z

Sessions aren't well understood by people ofc.

oyakushev 2024-09-08T12:26:53.840379Z

I haven't tried, but I expect socket REPL to behave the same. set! is thread-local, as long as the user doesn't expect different connections to execute on the same thread, then it shouldn't be surprising

oyakushev 2024-09-08T12:27:31.425599Z

But yeah, there's no way to globally change *warn-on-reflection* , and that's primarily Clojure's design decision.