Asynchronous Programming and Eventhandling in D

chmike via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 6 01:39:03 PDT 2016


On Tuesday, 5 July 2016 at 20:38:53 UTC, Eugene Wissner wrote:
> On Tuesday, 5 July 2016 at 08:24:43 UTC, O/N/S wrote:
>> Hi ("GrĂ¼ss Gott")
>>
>> I like the asynchronous events in Javascript.
>> Is something similar possible in D?
>>
>> Found Dragos Carp's asynchronous library 
>> (https://github.com/dcarp/asynchronous).
>> Are there any more integrated (in Phobos/in D) ways to work 
>> asynchronously?
>>
>> An example: One server ask a second server to calculate 
>> something big.
>> The first server continues with his work, until the answer 
>> come back from the second.
>> And so on...
>>
>> Using threads or fibers would be a way, but has not the same 
>> elegancy like the Javascript way. (To avoid discussions: D is 
>> better ;-)
>>
>>
>> Greetings from Munich,
>> Ozan
> Servus,
>
> I'm currently rewriting the base skeleton of libev in D (only 
> for linux for now) for web development aswell. And the next 
> step would be data structures, basic server, futures and yo 
> on...
> I was working with dcarp's asynchronous and i found it very 
> very good. It is till now the best I've seen in D for async 
> programming ( I mean its design and usability).
>
> Can you describe what would you like to see more concretly. I 
> know js but how is it supposed to work for D? Maybe you can 
> give some example, kind of pseudo code? It would help me much 
> to build a concept and maybe we will see someday something 
> usable in this area :)

The problem I see with libev is that it isn't compatible with the 
CPIO API of windows.
The C++ boost asio library, on the contrary, is compatible with 
the select/epoll/kqueue model and the Windows CPIO model.

This is the reason I started on a D implementation of asio I 
called dasio [https://github.com/chmike/dasio]. Unfortunately my 
alimentary work didn't leave me any time to make progress on it. 
The only thing I manage to implement so far is asio's error code 
system.

I'm glad to see other people see an interest to work on this. We 
definitely should find a way to combine our efforts. That is 
already a significant work made with the other libraries.

My feeling is that providing support for very efficient IO in 
Phobos might have a strong impact on D's visibility and adoption 
for backend applications (e.g. servers). Performance is a very 
strong argument for adoption is such context.

A list of requirements has been already published on the wiki.

What I think is now missing is a benchmarking tool so that we can 
get numbers for each async lib implementation that we can also 
compare with a raw C implementation using the native functions.



More information about the Digitalmars-d-learn mailing list