joker

Discuss all things joker, the Clojure interpreter/linter on top of Go. https://github.com/candid82/joker
mauricio.szabo 2019-10-28T03:37:17.027300Z

Hello, I'm just starting with Joker and I saw that the Socket REPL implementation only accepts a single connection. Is there any reason for that?

mauricio.szabo 2019-10-28T13:39:42.028700Z

Great to know there's an alternative. I'll probably stick with the single execution anyway, but great to see this tcpserver approach 🙂

jcburley 2019-10-28T04:38:35.027400Z

Do you mean at a time, or that you want it to repeatedly listen, accept, then (upon close) go back to listening?

mauricio.szabo 2019-10-28T04:47:21.027600Z

At a time, like, I can't have more than one connection to the socket repl at the same time

jcburley 2019-10-28T05:14:49.027800Z

Ah. Well, Joker is currently designed for only a single thread of (Joker) code execution. So if you're looking for multiple connections into a single instance of Joker (so they can effectively communicate with each other), that's not available. But if you'd be okay with each connection getting its own instance, you could look into putting an appropriate service (like https://cr.yp.to/ucspi-tcp/tcpserver.html, though I'm sure there are more-modern equivalents) up on the port, and have it launch a unique instance of Joker for each incoming connection. (I haven't yet tried that approach, but I might be giving it a go soon, since it fits some of my use cases for Joker.)

jcburley 2019-10-28T05:28:20.028100Z

This seems to work adequately (having done sudo apt install ucspi-tcp on my Ubuntu system):

$ tcpserver localhost 8888 ./tools/joker-server.sh --no-readline
That script (`joker-server.sh`) is simply:
#!/bin/sh

exec 2>&1
joker "$@"
It's rudimentary, but if you want each client to get its own Joker instance, it might be enough for you.

jcburley 2019-10-28T05:29:33.028300Z

(I'd like to see <http://github.com/chzyer/readline|github.com/chzyer/readline> support network connections, as some other libraries -- including, I assume, GNU's readline -- do. But that package seems to have been orphaned, as it has some longstanding issues and PRs.)

jcburley 2019-10-28T05:51:21.028500Z

Forgot to mention: each client does telnet localhost 8888 in my setup.