Clojurians
#lumo
<
2018-10-17
>

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

onetom14:10:31

i was just giving a try to lumo -n 5555 -D kitchen-async:0.1.0-SNAPSHOT using a tubular socket repl client from cursive eap8. my main use-case would be exploring http apis interactively, which is why i pulled in kitchen-async, hoping to ease the experience, but it breaks badly at the boundaries and im not sure what to do about it.

onetom14:10:23

when an expression evaluates to a Promise i wont see what it resolves to. if i tuck a (p/then the-promise-im-interested-in prn), then it will be printed on the terminal (but not always :/) where i started lumo, instead of the socket repl client, in the cursive repl window

onetom14:10:50

im wondering how others would deal with this

onetom14:10:50

ah, yeah, the multi-line expressions are also printing a bunch of secondary prompts but after it appears in the cursive console and all on one line, so the output is quite a mess. i was looking at the source hoping to replace the prompt strings, but it seems the repl.js:prompt() function is not exposed in the cljs context.

onetom14:10:15

im envisioning something like an automatic wrapper around promise return values with automatic printing of the resolved value, a timeout and a default .catch...

hlolli14:10:01

@onetom what is p in p/then, it's usually (-> a-promise (.then (fn [res] ..do smth..))). Did you try enabling dumb-terminal for the console logs, does it make a difference?

flag:
-d, --dumb-terminal

onetom14:10:31

haven't thought about that, but let's see

onetom14:10:23

doesn't make a difference

hlolli14:10:10

I guess then it's better to start the client in cursive, instead of socket-repl client. But not unlikely that you can transfer the logs over the socket, don't remember how it was, but I think stdout is transfered and stderr messages not. But let's see if someone else knows a better way.

onetom14:10:02

what do you mean by "start the client in cursive"?

hlolli14:10:04

I'm not a cursive user, but I mean, skipping the -n 5555 and just start lumo with shell command from within the cursive terminal (I suppose there's one there?)

hlolli14:10:15

I should use the word IntelliJ* as Cursive is just a plugin. But do note that there's quite small support for lumo in text editors, even in Emacs where all we have is inf-clojure mode.

onetom14:10:54

yeah, you can start it in a terminal, but that doesn't have any integration with the file editor area, so i can't send forms over to it... :confused:

onetom17:10:48

i was trying the custom socket repl accept function in lumo 1.9.0-alpha, but it seems to be ignored:

cljs.user=> dusty:lumo onetom$ lumo -n '{"port":5559, "accept":"XXX"}'
Lumo 1.9.0-alpha
ClojureScript 1.10.238
Node.js v9.10.1
...
Lumo socket REPL listening at localhost:5559.
cljs.user=>
then when i connect to it i get the usual repl behaviour:
dusty:lumo onetom$ nc localhost 5559
Lumo 1.9.0-alpha
ClojureScript 1.10.238
Node.js v9.10.1
...
cljs.user=> 123
123
cljs.user=>

onetom17:10:12

i was expecting to see an error, since XXX is obviously a bogus function reference. i was trying with lumo -n '{"port":5559, "accept":"ethlib.repl/accept"}' originally of course, where src/ethlib/repl.cljs is :

(ns ethlib.repl)
(defn accept [socket & args]
  (.end socket (str "\nHello friend.\nYou gave me the following args: " args "\n\n")))
which i copied from https://github.com/anmonteiro/lumo/blob/master/examples/socketAccept/hello/world.cljs

onetom17:10:11

i thought i would debug it by building my custom lumo, but it depends on the 5.90 GB Xcode... <sigh>

anmonteiro17:10:51

@onetom you can run lumo in development without compiling the C++ code

anmonteiro17:10:55

as long as you have Node.js installed

anmonteiro17:10:30

btw I’m sorry the workflow is so rough

anmonteiro17:10:40

but I don’t really use IntelliJ so I can’t really help

anmonteiro17:10:06

wrt to your latest question though, have you included the folder where the ethlib.repl namespace is in the classpath?

onetom17:10:34

it's in the src/ dir, which i would guess is in the class path, but i tried it with lumo -c src/ -n ... and it makes no difference

onetom17:10:00

how can i run a modified version of lumo without boot release?

onetom17:10:25

how are you using the lumo repl usually?

anmonteiro17:10:59

you can run the development version with boot dev

anmonteiro17:10:05

as long as you have Node.js installed

onetom17:10:03

i just tried an earlier lumo (installed with brew install lumo) and it doesn't complain about the bogus accept function either:

dusty:lumo onetom$ lumo -n '{"port":5559, "accept":"XXX"}'
Lumo 1.8.0
ClojureScript 1.9.946
Node.js v9.2.0
...
Lumo socket REPL listening at localhost:5559.
cljs.user=>

anmonteiro17:10:18

because the function hasn’t been run

anmonteiro17:10:28

it’ll probably fail if you telnet localhost 5559

anmonteiro17:10:45

that said, it looks like 1.9.0-alpha has a bug where it doesn’t run the accept function

anmonteiro17:10:49

mind opening an issue?

onetom17:10:06

indeed it did fail!

anmonteiro17:10:37

the function is only run when you connect to it

onetom18:10:05

sure, i thought so, that's why i was showing above a connection attempt too.

onetom18:10:30

im getting these circular dependency messages when i run boot dev:

...
Copying jar:file:/Users/onetom/.m2/repository/com/cognitect/transit-js/0.8.846/transit-js-0.8.846.jar!/com/cognitect/transit.js to /Users/onetom/.boot/cache/tmp/Users/onetom/github.com/anmonteiro/lumo/akl/fluhj4/main.out/com/cognitect/transit.js
Applying optimizations :simple to 82 sources
Optimizing with Google Closure Compiler, elapsed time: 19665.113763 msecs
Optimizing 82 sources, elapsed time: 20218.912582 msecs
Sifting output files...
Sifting output files...
Sifting output files...
Sifting output files...
Sifting output files...
Writing target dir(s)...
yarn run v1.10.1
$ node scripts/bundle.js --dev
Building development bundle...
Circular dependency: src/js/cljs.js -> src/js/repl.js -> src/js/cljs.js
Circular dependency: src/js/cli.js -> src/js/cljs.js -> src/js/repl.js -> src/js/socketRepl.js -> src/js/cli.js
Circular dependency: src/js/repl.js -> src/js/socketRepl.js -> src/js/repl.js
Circular dependency: src/js/cljs.js -> src/js/repl.js -> src/js/socketRepl.js -> src/js/cljs.js
Done in 4.50s.
Elapsed time: 54.387 sec

onetom18:10:32

is that expected?

anmonteiro18:10:52

JS can have circular deps

onetom18:10:03

then the build/ folder is empty :confused:

onetom18:10:02

yeah, i read the docs on the nodejs circular dependency handling the other week... it a weird choice how they just ignore it... :confused:

onetom18:10:53

i really wanted to debug this, but i guess i will just try to use the older version first, since that works

onetom18:10:34

I managed to run the development version with node target/bundle.js -c target/ after starting boot dev. i think it worth mentioning it in the README, because it's not very obvious

anmonteiro19:10:30

@onetom there’s yarn dev

anmonteiro19:10:47

which you can run to start lumo in dev

anmonteiro19:10:55

or npm run dev

onetom19:10:28

found https://github.com/anmonteiro/lumo/blob/master/CONTRIBUTING.md as i was making a pull request and yarn dev is mentioned there