3 ms·
> As for us, we've stopped using futures and promises for asynchronous > operations as we've found faster way to manage operations (our system > is written in C
by mariusaeriksen 14y ago
> As for us, we've stopped using futures and promises for asynchronous
> operations as we've found faster way to manage operations (our system
> is written in C++11). The best is to design your system in a way that
> you never have to wait/synchronize at all.
I think you've perhaps misunderstood: the futures described in the
presentation are not at all like, say for instance std::future or
java.util.concurrent.Future - that's why I called them "composable
futures". `flatMap` is the key to great power.
Our systems, using this variant of a "future", do not wait or
synchronize at all, as you describe.
Another thing that I highlight a lot in the presentation itself, but
does not come through in the slides is that this doesn't really have
anything to do with asynchronous IO at all, it has to do with
composing your operations from smaller operations. It's possible to
use asynchronous IO (as we do—with asynchronous operations throughout,
and with no waiting), but that is not necessary. The important bit is
this: composing larger operations from smaller ones leads to
inherently modular code; code that composes well within the context of
larger systems. That's the important bit. That it is also easy to
implement a performant execution system for this is gravy.
- shin_lao 14y agoI wholeheartedly agree about your second point - I blogged about it recently - http://blogea.bureau14.fr/index.php/2012/11/function-composition-in-c11/ http://blogea.bureau14.fr/index.php/2012/11/function-composi...