The forked elephant in the room

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Jan 16 10:13:15 UTC 2024


On 16/01/2024 10:54 PM, ikod wrote:
> Hello,
> 
> 
> On Tuesday, 16 January 2024 at 06:38:16 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
>> On 16/01/2024 3:25 PM, Mike Shah wrote:
>>> (As an aside, my Ph.D. work was in Java doing some concurrency 
>>> studies on performance -- so eventually I'd like to do more research 
>>> work in D on this topic)
>>
> 
>> What is very interesting is that in D, as long as a function is being 
>> compiled the compiler could slice and dice it into a coroutine object 
>> (such as a closure) without needing to be annotated as such explicitly.
> 
> In Rust compiler convert `async` code into state machine with context.

Yeah that is basically what a coroutine becomes.

>> It could be done implicitly upon the library struct that represents 
>> the language coroutine constructor.
>>
>> No async/await, no writing for asynchronously, just sequentially.
>>
> 
> I'd start from defining event loop API to decouple interface from 
> implementations.

I have done this in the past. You end up defining the user experience in 
the process.

Unless you go out of your way with something like coroutines, or fibers, 
you're pretty much stuck with callbacks of some kind and that is not 
going to fly.


More information about the Digitalmars-d mailing list