unrepl

discussing specification of an edn-based repl and its implementations.
pesterhazy 2017-12-15T09:16:15.000316Z

@cgrand trying out plain-repl:

WARNING: Use of undeclared Var lumo.repl/load-data-readers! at line 110 plain_repl/lumo.cljs
events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:352:12)
    at plain_repl$lumo$accept_$_epl (evalmachine.<anonymous>:653:8)
    at evalmachine.<anonymous>:294:11
    at Socket.<anonymous> (evalmachine.<anonymous>:101:10)
    at emitNone (events.js:110:20)
    at Socket.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1059:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)

pesterhazy 2017-12-15T09:16:33.000096Z

and in nc: #object[TypeError TypeError: Cannot read property 'call' of undefined]

pesterhazy 2017-12-15T09:17:03.000152Z

this is on lumo 1.7.0 - are you on 1.8 beta?

cgrand 2017-12-15T09:17:21.000121Z

I’m using lumo master

pesterhazy 2017-12-15T09:17:41.000364Z

I'll try 1.8.0 beta

cgrand 2017-12-15T09:17:44.000143Z

(as of weeks ago)

pesterhazy 2017-12-15T09:22:09.000190Z

that works

pesterhazy 2017-12-15T09:28:00.000398Z

pretty cool. I noticed it ends the lumo process when I type ^D but other than that it works

pesterhazy 2017-12-15T09:29:56.000102Z

trying to wrap my head around what this does though haha

cgrand 2017-12-15T10:30:06.000007Z

haha found a new minimal formulation!

pesterhazy 2017-12-15T12:33:46.000104Z

welcome @matttylr and @l0st3d

Ed 2017-12-15T12:34:04.000264Z

@pesterhazy hi 😉

matttylr 2017-12-15T12:34:10.000164Z

Hi

richiardiandrea 2017-12-15T16:20:08.000293Z

Saw plain repl nice!

cgrand 2017-12-15T16:22:20.000210Z

@richiardiandrea I’ve found a better way.

👍 1
cgrand 2017-12-15T16:23:56.000173Z

Better = simpler api and less impact on lumo

gcast 2017-12-15T16:24:39.000032Z

Does unrepl.el currently support sending new deps to a running SOCKET repl?

richiardiandrea 2017-12-15T16:34:34.000796Z

@cgrand would love to try that ;)

gcast 2017-12-15T16:37:18.000321Z

darn! I was hoping to use the image rendering feature of unrepl.el to generate graphs of datomic query results but my datomic SOCKET repl is bare bones.

gcast 2017-12-15T16:37:53.000413Z

lol may have to use unravel to send deps and then unrepl.el to render graphs once deps are available

cgrand 2017-12-15T16:43:22.000012Z

@gcast yes, you can even add to the classpath while the repl is running

cgrand 2017-12-15T16:43:50.000284Z

But no packed printing

gcast 2017-12-15T16:55:43.000420Z

@cgrand yes to my hacky workaround or yes to sending deps to socket repl using unrepl.el

cgrand 2017-12-15T17:04:16.000177Z

@gcast no to your hacky workaround, because of classpath isolation deps added in one repl may not be visible on another (once loaded generally they are but in subtle cases it may fail)

cgrand 2017-12-15T17:04:56.000092Z

so unrepl.el allows extending the classpath, even while the repl is already running

cgrand 2017-12-15T17:05:46.000534Z

@gcast @volrath is unrepl.el owner

cgrand 2017-12-15T17:07:23.000080Z

@pesterhazy @volrath, @gcast is the happy unravel user/evangelist I talked about earlier

👍 1
cgrand 2017-12-15T17:14:03.000029Z

@richiardiandrea I pushed a WIP which you may help with (a problem with ns not being set after eval)

cgrand 2017-12-15T17:14:20.000234Z

however the new design is ok

richiardiandrea 2017-12-15T17:14:33.000121Z

Ok cool let my try that

cgrand 2017-12-15T17:16:12.000037Z

Quick explanation: https://github.com/Unrepl/plain-repl/blob/master/src/plain_repl/min.cljs is impl agnostic stuff that should be better added to cljs but in the meantime, why not spawn this file in a standalone dep

cgrand 2017-12-15T17:18:06.000464Z

No more *in*as I’ve been struggling to fine an ok way to manage (or arather encourage) exclusive ownership of a global resource

cgrand 2017-12-15T17:19:03.000598Z

So when eval retuns a suspension it means the host repl must pause and yield control to the suspension, passing in as an argument.

cgrand 2017-12-15T17:20:24.000471Z

https://github.com/Unrepl/plain-repl/blob/master/src/plain_repl/repl/lumo.cljs is the platform specific code

richiardiandrea 2017-12-15T17:21:38.000099Z

Ok cool, so what about ns problem you have?

cgrand 2017-12-15T17:23:28.000035Z

In eval I always get nil out for ns

cgrand 2017-12-15T17:24:17.000300Z

There are minor ns conveyance issues but the crux is that one.

richiardiandrea 2017-12-15T17:31:17.000429Z

Ok, almost in front of my pc

richiardiandrea 2017-12-15T17:40:41.000315Z

is the branch on lumo?

richiardiandrea 2017-12-15T17:41:10.000266Z

cannot find branches in plain-repl

richiardiandrea 2017-12-15T17:41:20.000656Z

(also why plain 😄 ?)

richiardiandrea 2017-12-15T17:41:52.000047Z

oh got it, no unrepl..

richiardiandrea 2017-12-15T18:14:31.000134Z

so yes basically by using that eval you are changing the global *ns*...which is kept in https://github.com/anmonteiro/lumo/blob/master/src/cljs/snapshot/lumo/repl.cljs#L41

richiardiandrea 2017-12-15T18:14:46.000328Z

(btw sorry if I say something you know already)

richiardiandrea 2017-12-15T18:15:12.000069Z

it seems to me that your "sessions" should have their own current-ns getter

cgrand 2017-12-15T20:16:02.000056Z

I was on my phone so giving you details was arduous.

cgrand 2017-12-15T20:21:32.000058Z

in eval, before calling cljs/eval, current-ns contains 'cljs.user and both *ns* and ana/*cljs-ns* have been set. When cljs/eval returns the value for key :ns is nil. No matter what I eval (even if it changes the current namespace).

richiardiandrea 2017-12-15T20:49:42.000318Z

Uhm ok will look into that

cgrand 2017-12-15T20:59:02.000356Z

found

cgrand 2017-12-15T20:59:41.000247Z

there are too many evals in cljs.js-> discrepancies

cgrand 2017-12-15T21:01:10.000187Z

I pushed the fix.

richiardiandrea 2017-12-15T21:11:39.000041Z

yes I was following the dots as well 😉

richiardiandrea 2017-12-15T21:12:50.000188Z

oh you were using eval from cljs.js gotcha

richiardiandrea 2017-12-15T21:16:32.000125Z

uhm..stiill not working here...

cgrand 2017-12-15T21:20:59.000360Z

how?

cgrand 2017-12-15T21:22:05.000441Z

the accept ns has changed

cgrand 2017-12-15T21:22:15.000210Z

(I just edited the README)

richiardiandrea 2017-12-15T21:22:24.000301Z

ok let me see if I am doing it right

cgrand 2017-12-15T21:23:28.000142Z

lumo -c src/ -n ‘{“port”: 5557, “accept”: “plain-repl.repl.lumo/accept”}’

cgrand 2017-12-15T21:23:52.000197Z

$ nc localhost 5557
cljs.user=> (+ 3 4)
7
cljs.user=> (ns foo.bar)
nil
foo.bar=> *ns*
#object[cljs.core.Namespace]
foo.bar=> (ns-name *1)
foo.bar
foo.bar=>

richiardiandrea 2017-12-15T21:25:46.000033Z

ok that works, the client side in the README throws:

return caught_SINGLEQUOTE_.call(null,e,rrepl);
                           ^

TypeError: Cannot read property 'call' of null
    at plain_repl$repl$caught (evalmachine.<anonymous>:471:28)
    at plain_repl$repl$pl (evalmachine.<anonymous>:436:15)
    at plain_repl$repl$then_pl (evalmachine.<anonymous>:429:11)
    at plain_repl$repl$lumo$eval (evalmachine.<anonymous>:229:4)
    at plain_repl$repl$epl (evalmachine.<anonymous>:410:26)
    at evalmachine.<anonymous>:241:11
    at evalmachine.<anonymous>:156:11
    at plain_repl.repl.lumo.bytes_stream_reader.cljs$core$IFn$_invoke$arity$2.plain_repl.repl.lumo.t_plain_repl$repl$lumo60.plain_repl$min$AsyncReader$read_chars$arity$2 (evalmachine.<anonymous>:102:10)
    at plain_repl$min$read_chars (evalmachine.<anonymous>:14:10)
    at plain_repl$repl$skip_if_eol (evalmachine.<anonymous>:149:34)

richiardiandrea 2017-12-15T21:28:09.000366Z

I also tried (in-ns 'foo.bar) and it hangs...should be because it is a special function

cgrand 2017-12-15T21:32:57.000449Z

Oh I haven’t tried exception, looks like I have a bug.

cgrand 2017-12-15T21:33:11.000518Z

No in-ns

aengelberg 2017-12-15T21:50:04.000331Z

I'm trying out unravel for the first time but it doesn't seem to work with my basic socket repl:

unravel localhost 50505
evalmachine.<anonymous>:22
var reader = cljs.reader.push_back_reader.call(null,s);
                                         ^

TypeError: Cannot read property 'call' of undefined
    at unravel$lisp$safe_read_string (evalmachine.<anonymous>:22:42)
    at Transform._transform (evalmachine.<anonymous>:56:60)
    at Transform._read (_stream_transform.js:186:10)
    at Transform._write (_stream_transform.js:174:12)
    at doWrite (_stream_writable.js:385:12)
    at writeOrBuffer (_stream_writable.js:371:5)
    at Transform.Writable.write (_stream_writable.js:288:11)
    at Transform.ondata (_stream_readable.js:642:20)
    at emitOne (events.js:115:13)
    at Transform.emit (events.js:210:7)

aengelberg 2017-12-15T21:50:41.000074Z

I installed this with brew install, is there potentially a lumo problem at play?

aengelberg 2017-12-15T21:51:39.000245Z

$ unravel --version
Unravel 0.2.2 (Lumo 1.7.0)

cgrand 2017-12-15T21:52:16.000292Z

I may be burying the lead with my repl impl.

cgrand 2017-12-15T22:04:28.000032Z

@aengelberg better build from source

cgrand 2017-12-15T22:08:29.000377Z

(Give the packed-printing branch a try :-) and you have to launch it with —flag packed to enable it.