clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
ghadi 2021-02-17T02:30:11.157700Z

@hiredman in the clojure.main repl you can override eval to e.g. add a wrapper that submitted code somewhere central for tooling, but that doesn't seem possible with prepl - eval is hardcoded so any envelope would have to be added by the submitter, not the REPL receiver

borkdude 2021-02-17T07:48:51.161200Z

@seancorfield note that interrupted eval in nREPL relies on Thread#stop which is deprecated and not even available anymore in newer VMs like GraalVM (this is why bb doesn’t support this in its REPLs)

2021-02-17T09:14:48.161400Z

As far as I have seen, every REPL that supports interruptable eval uses Thread#stop today. I have only confirmed with nREPL 0.6.0 with Lein 2.9.3 and unrepl / unravel, but there really is no other mechanism that can be used to stop a thread that is in a "ignore the world" infinite loop, i.e. that doesn't use the recommended method of avoiding Thread#stop because it checks for some global variable change or similar thing in its inner loops.

2021-02-17T09:16:01.161600Z

It makes perfect sense to me that Thread#stop is deprecated -- not trying to argue against deprecating it. It makes sense why people decide to use it anyway.

2021-02-17T09:16:27.161800Z

(well, many of them without knowing they are using it, perhaps)

borkdude 2021-02-17T09:17:28.162Z

Yes, I wish it was just available in GraalVM

2021-02-17T09:36:36.162200Z

Thread#stop is still available in JDK 15, FYI -- I haven't checked JDK 16.

seancorfield 2021-02-17T17:37:06.162900Z

Yeah, @hiredman pointed that out in a thread to me, and I think he did a quick check and that's how they all work -- because it's all there is on the JVM right now (unless your compiled code includes collaborative checks on a global "abort" flag). He also shared some code with me that made me feel a bit better about building something very simple and prepl-based that might provide the sort of minimal almost-no-code REPL that I'd like to see (but, frankly, at this point I doubt anyone is going to unseat nREPL).

2021-02-17T17:46:42.163100Z

the jvm tooling interface (I guess what jvm agents use?) has an optional command to kill threads too https://docs.oracle.com/en/java/javase/15/docs/specs/jvmti.html#StopThread which it says is like Thread.stop, but I don't see a bunch of "Keep Out" signs posted all around it

2021-02-17T17:58:43.163300Z

Probably they figured that if you read that, you will read the docs for Thread#stop, too. I would guess there are a lot of potential 'here be dragons' methods in tooling interfaces besides that issue.

devn 2021-02-21T07:47:00.001Z

You can’t take my SIGKILL away!