futures and related asynchronous combinators

Vlad Levenfeld via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Mar 27 02:12:52 PDT 2016


On Sunday, 27 March 2016 at 08:16:22 UTC, Eugene Wissner wrote:
> On Sunday, 27 March 2016 at 07:16:53 UTC, Vlad Levenfeld wrote:
>> 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);
>
> Hi Vlad,
>
> Are you intend to open source other parts of your work?
> Can I ask what are you using for your async stuff: libasync, 
> vibe, asynchronous or something self written?

For things like timers, event loops and networking in my current 
project I am using libasync.

As for other parts of my work: I've been getting some good 
mileage out of a small set of generic primitives for operating on 
serial streams, I will probably pull them out and release them 
with some documentation soon.


More information about the Digitalmars-d-announce mailing list