kovasb / session

repl into the clojurescript community
Eclipse Public License 1.0
459 stars 36 forks source link

nrepl backend #29

Closed jonase closed 10 years ago

jonase commented 11 years ago

I think it would make sense to use nrepl as the evaluation service. It would open the door for simple solutions to at least the following issues:

Some work has already been done in an old patch by @hiredman (#3). I could try to move this forward if you (@kovasb) still think it’s a good idea.

[1] https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/interruptible_eval.clj

kovasb commented 11 years ago

I think going "nrepl" is a good next step.

Should session be a middleware, a transport, both, or neither? Trying to get up to speed on the design of nrepl.

In any case, it would be great to support both a) evaluation from the session web UI b) evaluation from other nrepl clients (and log the back-and-forth traffic in datomic)

The main design question is, how should this traffic be represented in datomic? The main options seem to be a) treat the messages as a string b) have a more granular schema to capture the map components as attributes

In the longer term we'll also want to hook into the likes of ritz.

There are some interesting design notes at https://github.com/clojure/tools.nrepl/wiki/nREPL.Next that I will try to internalize.

kovasb commented 11 years ago

Is there a list of repl endpoint implementations somewhere?

The base case example shows starting up the server on a port, and connecting the client to it.

I'm looking for a way to do it without ports for our base case (when the session server and the nrepl endpoint are in the same jvm) . Seems there should be a way but requires understanding the code.

kovasb commented 11 years ago

If we make an nrepl schema, we'd want it to somehow mirror whats here: https://github.com/clojure/tools.nrepl/blob/master/doc/ops.md

jonase commented 11 years ago

First cut at nrepl backend here: https://github.com/jonase/session/compare/master...nrepl

Note that there are more changes than are necessary for the nrepl backend as i did the work in a branch where I had previously made the datomic connection and aleph channel explicit (inside a ctx map) instead of as global vars.

The interesting part for the nrepl backend is probably the new session.nrepl namespace and corresponding schema changes.

kovasb commented 11 years ago

Thats great news! Is there any reason not to merge this in?

kovasb commented 10 years ago

In the latest version of session, we are going with a different architecture that is not particularly compatible with nrepl...