Why was Flow developed?

Flow and Boost ASIO are kind of orthogonal to each other. In fact, Flow uses asio internally…

ASIO is a platform independent abstraction for event based programming (select, poll, epoll etc). Flow however is a programming language (or rather a C++ extension) that implements the actor model. Flow uses stackless coroutines to do that. Additionally it also provides a rich set of libraries (flow, fdbrpc) for asynchronous programming within said framework. But these don’t actually use operating system functionality directly but rather use asio and libeio (the exception here is kernel AIO on Linux).

I am probably the wrong person to comment too much about FDBs history. But AFAIK the motivation behind Flow was testing. FoundationDB (the company) built a simulator before they built a database. And in order to build this simulator they needed a proper abstraction. So they wrote flow.

Flow also solves some problems that you have in a typical program that uses asio: you don’t get a callback hell which is nice (instead you can use something similar to async and await - but in flow it is called ACTOR and wait). Basically writing flow code feels like writing blocking code but the actor compiler will translate it to callbacks for you. This should also be faster than using a stackful coroutine library.

2 Likes