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.
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.
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?
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.
if it's not the default for clojure, then it shouldn't be the default for nrepl. it'll cause confusion and annoyance
Is the problem that using set! on it from an nrepl doesn't quite do what you might expect?
Well, it should. What exactly is wrong when you set! it?
It does, as long as you're using the same session in multiple places, etc.
Sessions aren't well understood by people ofc.
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
But yeah, there's no way to globally change *warn-on-reflection* , and that's primarily Clojure's design decision.