Fork me on GitHub
#cursive
<
2020-05-24
>
tengstrand08:05:06

@cfleming When I stop at a breakpoint, I can evaluate constants like 123, but I can't evaluate variables or expressions with variables. It's like they are invisible to the evaluator. I have a list of variables in IDEA, but they can't be evaluated. I run IntelliJ IDEA 2019.3.4 Community edition, Cursive 1.9.1.2019.3. I have tried both JDK 1.8.0_241 and JDK 11.0.6 but nothing works.

cfleming09:05:55

That looks like https://github.com/cursive-ide/cursive/issues/2345, which is fixed in the latest EAP series but hasn't made it into a stable build yet. I hope that will be soon.

p-himik14:05:06

Can you share how the "Interrupt Current Evaluation" is implemented?

cfleming21:05:24

Sure, currently this only works for nREPL, and it just sends the nREPL interrupt op. On the server side, nREPL starts a new thread for each eval, and uses Thread.stop() to kill them.

p-himik07:05:08

Thanks! I was overoptimistically hoping for some solution that didn't involve Thread.stop(). :)

cfleming09:05:29

The problem is that there is no general solution that doesn't use that.

cfleming09:05:41

I've seen a lot of complaints about its use, and lots of dire warnings, but the simple fact is that there's no alternative except not allowing interrupts at all (or just interrupting the thread, which will not work for runaway evaluations). The main issue with Thread.stop() is that it will leave dangling object monitors, but that's not really an issue for a lot of dev use cases, and I'm sure no-one is REPLing into prod.

p-himik09:05:28

Yeah, I wasn't complaining. I was just hoping there was some other mechanism that I didn't know about.

cfleming10:05:21

No, sadly there is no magic :)