lumo

:lumo: Standalone ClojureScript environment. Currently at version 1.9.0
2017-08-15T05:24:45.000018Z

is it possible to use lumo to build binaries from Clojure programs? If so how?

pesterhazy 2017-08-15T22:44:33.000140Z

Top-level await is coming to the chrome dev tools: https://twitter.com/umaar/status/897408737694109697

pesterhazy 2017-08-15T22:44:44.000280Z

Something like that for lumo would be awesome

anmonteiro 2017-08-15T22:45:10.000115Z

@pesterhazy what do you mean

anmonteiro 2017-08-15T22:45:16.000130Z

probably very easy to do with a macro

pesterhazy 2017-08-15T22:45:30.000023Z

I think it requires support from the repl infrastructure

pesterhazy 2017-08-15T22:46:13.000094Z

essentially this feature makes the prompt block until the (async) response comes back

pesterhazy 2017-08-15T22:47:01.000044Z

as far as I understand it at least?

pesterhazy 2017-08-15T22:49:18.000134Z

I mean this works today

(async () => `Homepage: ${(await fetch(location.href)).status}`)().then(console.log)

anmonteiro 2017-08-15T22:50:17.000012Z

right

anmonteiro 2017-08-15T22:50:23.000017Z

blocking will need extra support

anmonteiro 2017-08-15T22:50:28.000115Z

otherwise it can be achieved

pesterhazy 2017-08-15T22:50:45.000176Z

i'm curious how they handle a promise that never fires...

anmonteiro 2017-08-15T22:51:05.000091Z

like:

(defn x []
  (js/Promise. (fn [resolve reject] (resolve 42))))

(js* "(async () => ~{}(await ~{}))();" js/console.log (x))

anmonteiro 2017-08-15T22:51:07.000293Z

🤓

pesterhazy 2017-08-15T22:51:39.000240Z

haha nice

anmonteiro 2017-08-15T22:51:57.000134Z

^ can easily turn that into an await macro

anmonteiro 2017-08-15T22:52:11.000166Z

that you call like (await js/console.log (x))

pesterhazy 2017-08-15T22:52:37.000009Z

right

pesterhazy 2017-08-15T22:52:41.000133Z

hm...

anmonteiro 2017-08-15T22:52:41.000341Z

still not sync

pesterhazy 2017-08-15T22:54:01.000356Z

what if lumo detected a promise as a return value and (optionally) awaited its result

pesterhazy 2017-08-15T22:54:13.000209Z

for example, (await ...) could be a repl-special

pesterhazy 2017-08-15T22:54:58.000044Z

that'd be amazing for experimenting with async apis which, honestly, is most apis in node

pesterhazy 2017-08-15T22:55:39.000126Z

so (await (x)) would block until ^C or a promise resolution

pesterhazy 2017-08-15T22:56:54.000244Z

(await) would be accepted only as a top level form

pesterhazy 2017-08-15T22:57:03.000111Z

I guess similar to (require)?

anmonteiro 2017-08-15T23:04:23.000130Z

@pesterhazy feel free to open an issue

anmonteiro 2017-08-15T23:04:45.000030Z

that’d probably require some tinkering and refactoring

anmonteiro 2017-08-15T23:04:48.000153Z

but sounds like a good idea

pesterhazy 2017-08-15T23:05:13.000011Z

ok will do