5 ms·
Doing networking in the standard library without introducing a proper async framework is just more madness. Polishing off promises and futures, and getting coro
by nly 11y ago
Doing networking in the standard library without introducing a proper async framework is just more madness. Polishing off promises and futures, and getting coroutines nailed down, would have made introducing an intuitive network library a doddle.
Instead we'll get something carved out of ASIO, which is a complete mess full of gross unintuitive APIs and callbacks.
- gpderetta 11y agoWhat's wrong with ASIO interface? My only issue with it is that once a socket is bound to an io_service it can't be easily rebound to another one. For many applications where C++ is used, promises and futures introduce unnecessary overhead. On the other hand an ASIO-like interface works just fine. Additionally, ASIO, and by extension the network proposal, have transparent opt-in support for futures via a special callback type.
- nly 11y agoExample terrible API: You have to create a socket for a new connection before calling async_accept. Try using this with coroutines. > opt-in support for futures via a special callback type. Which is ugly. The coroutines opt-in as well. Coroutines actually have the potential to be faster than callbacks.