cursive-ide / cursive

Cursive: The IDE for beautiful Clojure code
579 stars 7 forks source link

Implement an Unrepl client #1928

Open ghost opened 6 years ago

ghost commented 6 years ago

It would be nice if Cursive would implement an Unrepl client, in addition to the plain REPL and nREPL clients. This should allow for it to be used with the Socket REPL of Clojure 1.8 (see also #1919).

The general idea behind Unrepl is to have a set of REPL protocols with a common base (Unrepl), based on which different Unrepl clients implement their own Unrepl server. This server implementation is then loaded as a payload ("blob") into the target process through a Socket REPL, where it will start a new Unrepl REPL server. Finally the Unrepl client connects to the Unrepl server it just started.

The benefit of this process is, that the target process does not need to include with REPL code, since the Socket REPL implementation is already included in Clojure 1.8+ and everything else is loaded only when needed and can be extended according to the needs of the client. Due to the shared common base, it should be easy to share parts of the server implementation between different Unrepl derivatives.

cgrand commented 6 years ago

@urzds:

This server implementation is then loaded as a payload ("blob") into the target process through a Socket REPL, where it will start a new Unrepl REPL server. Finally the Unrepl client connects to the Unrepl server it just started.

Speaking of server is maybe misleading. The blob is used to upgrade the current connection to an unrepl connection; it doesn't start a server (with an open port etc.) to which we later connect. It just changes the nature of the current connection.