Clojurians
#lumo
<
2017-12-20
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

cgrand15:12:32

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

cgrand15:12:35

cljsSender is a nasty global when dealing with multiple sessions

cgrand16:12:45

(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.

cgrand16:12:53

the equivalent clojure code is:

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

cgrand16:12:03

@anmonteiro I’d like your opinion on this

hlolli16:12:54

@cgrand very nice :slightly_smiling_face: works! Just the damn prompt jumps sometimes into the text field. Easy bug to fix I guess.

hlolli16:12:34

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.

cgrand16:12:35

@hlolli unrepl still have to be ported :slightly_smiling_face:

hlolli16:12:31

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).

hlolli16:12:17

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

cgrand16:12:01

with two different connections or only one?

hlolli16:12:10

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?

cgrand16:12:42

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

cgrand16:12:29

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

hlolli16:12:10

Wow :slightly_smiling_face:

cgrand17:12:16

it’s a bit like tea spoons, you need one or two for the pot :wink:

cgrand17:12:47

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

richiardiandrea17:12:36

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

richiardiandrea17:12:59

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?

hlolli17:12:07

@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 :slightly_smiling_face: not good :slightly_smiling_face:

richiardiandrea17:12:39

@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

hlolli17:12:52

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.

hlolli17:12:39

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....

richiardiandrea17:12:39

@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.

richiardiandrea17:12:44

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

hlolli17:12:35

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.

hlolli17:12:15

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

richiardiandrea18:12:22

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

cgrand22:12:01

@richiardiandrea what is not possible at all exactly?

richiardiandrea22:12:27

To have multiple connections

richiardiandrea22:12:44

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

cgrand22:12:22

What do you mean by plain repl?

richiardiandrea22:12:58

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