Aff and Promise event queues?

I have some questions about Aff.

V8 has an asynchronous completion queue. This is how JavaScript Promises are completed.

Aff has its own completion queue, by @natefaubion :

Why does Aff need its own completion queue? What do we get from that approach that we can’t get from just using the V8 queue, as in promises?

Having two async completion queues going in the same runtime strikes me as susceptible to starvation and strange race conditions? Do we have to attend to how they interact? Is aff-promise really as effortless as it looks, @nwolverson ?


I guess React also has its own asynchronous completion queue.

So using Aff in a React app, we have three asynchronous completion queues in the runtime, each scheduling work for the one OS thread. Does this work out well in practice? In my limited experience… yes, it seems fine?

1 Like

Maybe Aff needs its own async completion queue because JavaScript Promise.resolve() flattens nested promises?

1 Like

Here’s a nice discussion of Async Programming in PureScript by @natefaubion


@and-pete on Slack:

Just remembered now when seeing this other video that talks about errors in Aff here for a bit: (starting 24mins into the video; more of a casual discussion than the other video’s presentation)
They talk for a bit about this Issue thread on errors in Aff which answers a lot about errors in Aff for me:
…with some further stuff you can gleam about the situation with Aff now vs where it might go in

1 Like