Fork me on GitHub
Logan Powell17:08:56

quick question, if I get a promise returned from a javascript library, will it be handled gracefully within a core.async chan?

Logan Powell18:08:44

This seems to me to be some ways to mimic promise.all rather than convert a promise into something that can be consumed by a chan

Logan Powell18:08:49

am I mistaken?


core.async AFAIK knows nothing about javascript promises directly


I'll double check


yeah, sorry, it wasn't what I thought it was

Logan Powell18:08:04

Maybe something like this?

Logan Powell18:08:26

that won't work though, will it, because it's async

Logan Powell18:08:36

sorry, let me just give that a shot


that will "work" but because you aren't using the callback version of put! you lose any communication of back pressure between promise and chan land

Logan Powell18:08:02

ah, so it should be used sparingly... would it be ok for a chan with a buffer of 1 and then closed?

Logan Powell18:08:15

just using the chan as a handoff point

Logan Powell18:08:34

ok, thank you sir


yes, right if the chan is one and done

Logan Powell18:08:13

or would the coordination between the chan and other functions be miscommunicated

Logan Powell18:08:08

the cljs js-library interop story has some dragons in it

Logan Powell18:08:42

I think the hipster thing in javascript land (circa 2015) was Promises everywhere

Logan Powell18:08:10

nowadays, they're looking at async/await as the new hotness. They don't know what they're missing in core.async over there