lumo

:lumo: Standalone ClojureScript environment. Currently at version 1.9.0
cgrand 2017-12-20T15:16:32.000376Z

there are issues around prompt (which is appears spuriously when suspended) and bindings (one socket repl out appearing in another)

cgrand 2017-12-20T15:21:02.000734Z

^^diff

cgrand 2017-12-20T15:59:35.000686Z

cljsSender is a nasty global when dealing with multiple sessions

cgrand 2017-12-20T16:08:45.000023Z

(x-post with #unrepl) Brave souls can try to build lumo from https://github.com/cgrand/lumo/tree/suspension on this branch the stock repl (both term & socket) is upgradable Example:

(lumo.repl/suspension-request
  (fn [r resume]
    (let [print-fn *print-fn*]
      (lumo.repl/read-chars r
        (fn loop [s]
          (if (re-find #"bye" s)
            (resume {:value :ok})
            (binding [*print-fn* print-fn]
              (println "you said: " s)
              (lumo.repl/read-chars r loop))))))))
minor issues to fix: line delimters are not returned, readline prompt is not disable while the repl is suspended.

πŸ‘€ 1
cgrand 2017-12-20T16:10:53.000520Z

the equivalent clojure code is:

(loop []
  (let [s (.readLine *in*)]
    (if (re-find #β€œbye” s)
      :ok
      (do
        (println β€œyou said: ” s)
        (recur)))))

cgrand 2017-12-20T16:14:03.000473Z

@anmonteiro I’d like your opinion on this

2017-12-20T16:34:54.000138Z

@cgrand very nice πŸ™‚ works! Just the damn prompt jumps sometimes into the text field. Easy bug to fix I guess.

2017-12-20T16:38:34.000524Z

I was in the term not socket. I can see this being implemented into inf-clojure right away. Or I may check the status of Daniel's new unrepl clojure mode and try that.

cgrand 2017-12-20T16:39:35.000400Z

@hlolli unrepl still have to be ported πŸ™‚

2017-12-20T16:42:31.000861Z

yes.. but how I want to use this is basucally something like (socket-send lumo-udp-info-blabla "$c red") -> the suspension receives it and relizes that this is actually a code sent by editor asking for a completion of symbols starting with red. Saveing the "read" part and go straight to eval (or callback).

2017-12-20T16:43:17.000891Z

dollar sign maybe not a good protocol. But this was not toroughly thought idea anyway

cgrand 2017-12-20T16:45:01.000360Z

with two different connections or only one?

2017-12-20T16:47:10.000359Z

another good point, two connections would be best, but that exceeds my thinking of how to implement one. You've been working with two or more connecions on a single repl?

cgrand 2017-12-20T16:52:42.000936Z

unrepl.el and unravel use at least 3 connections to the repl

cgrand 2017-12-20T16:53:29.000352Z

and I have tested lumo with multiple connections, each differently upgraded

2017-12-20T16:57:10.000323Z

Wow πŸ™‚

cgrand 2017-12-20T17:02:16.000789Z

it’s a bit like tea spoons, you need one or two for the pot πŸ˜‰

😁 1
cgrand 2017-12-20T17:02:47.000044Z

1 for the user, 1 (or more) for tooling, 1 for the classloader

richiardiandrea 2017-12-20T17:21:42.000391Z

soooo

richiardiandrea 2017-12-20T17:22:36.000367Z

about inf-clojure, I guess plain repl does not have yet all the fancy features right?

richiardiandrea 2017-12-20T17:23:59.000328Z

ok that is not possible at all in inf-clojure at the moment. It would be cool to have though...if things go right probably in unrepl.el I guess?

2017-12-20T17:32:07.000252Z

@richiardiandrea I guess I will be quick to stop using inf-clojure. The problem with it, is just that it mixes up the return values too frequently, causes my emacs to freeze and prints code intended for eldoc into the repl window. This is especially annoying when I'm performing music with inf-clojure, that has happened, in Belin night club, that the music haults for a second because inf-clojure didn't know what to do with a list of completions πŸ™‚ not good πŸ™‚

richiardiandrea 2017-12-20T17:34:39.000190Z

@hlolli yeah well, that is a know problem of emacs being single threaded...however anything can be improved, for instance emacs understands json and the completion logic can be greatly simplified. I spent innumerable hours trying to detect edge cases with regexes on strings...that is why we need a protocol

2017-12-20T17:36:52.000018Z

So to make emacs experience better, then it's either to make lumo respond much faster (the idea of different protocol for inf-clojure->lumo interaction) or cgrand's idea of multiple socket instances, then there's no doubt what emacs should be doing with data coming from x and y udp responses.

2017-12-20T17:39:39.000192Z

well, that won't make lumo faster tough, I think best to mix the both, just call a compiled function for frequent communication of metadata/completions and the different udp instances. At least to minimize reading of clojure s-expressions, determine namespaces, resolve macros, determine if nil should be printed, this chain of reading takes sub-second but longer than millisecond....

richiardiandrea 2017-12-20T17:42:39.000375Z

@hlolli yes not faster lumo but better tooling can be built around it because now the protocol is solid (no more string parsing), kind of like the idea of using the Server Language Protocol.

richiardiandrea 2017-12-20T17:43:44.000017Z

if somebody would implement that, emacs + all the other editors (Atom...) would work out of the box

2017-12-20T17:46:35.000348Z

That protocol can be different, maybe in the future this may become a standard. But Atom can if this gets merged, say to lumo "this is how I'm going to communicate with you and this is how I want you to respond with me". Bit slower startup time, but potentially way faster interaction, each time s-expression parsing is avoided.

2017-12-20T17:47:15.000634Z

But Server Language Protocol is what I'm essentially talking about I think.

richiardiandrea 2017-12-20T18:01:22.000362Z

maybe there can be a unrepl -> SLP at some point

cgrand 2017-12-20T22:13:01.000166Z

@richiardiandrea what is not possible at all exactly?

richiardiandrea 2017-12-20T22:13:27.000052Z

To have multiple connections

richiardiandrea 2017-12-20T22:13:44.000178Z

But I think I can peek at @volrath code for that

cgrand 2017-12-20T22:21:22.000240Z

What do you mean by plain repl?

richiardiandrea 2017-12-20T22:40:58.000547Z

I mistakenly thought that the above was doing something more...it's not even the plain repl..sorry!