https://github.com/evenex/future/

I've been having to do a lot of complicated async work lately (sometimes multithreaded, sometimes not), and I decided to abstract a some patterns out and unify them with a little bit of formalism borrowed from functional languages. I've aimed to keep things as simple as possible while providing a full spread of functionality. This has worked well for me under a variety of use-cases, but YMMV of course.

Anyway I've occasionally seen people on IRC asking about futures, so I thought I'd share and make this announcement.

This lib depends on another lib of mine (for tagged unions and related things) which might not appeal to some but if there is demand for futures sans dependencies I can always go back and manually inline some of the templates.

TL;DR:

  auto x = async!((y,z) => y + z)(1,2);
  x.await;
  assert(x.result.success = 3);

Reply via email to