Reviving Phobos

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Apr 11 18:21:06 UTC 2023


On 12/04/2023 5:56 AM, Dmitry Olshansky wrote:
>> But as far as fibers are concerned? Kill them off. They are a target + 
>> platform + system C compiler ABI hack. They waste GC time scanning 
>> memory which has no valid data in it.
>>
>> The solution should be coroutines.
> 
> I like coroutines in Kotlin for that matter, the only downside is 
> suspendable vs nonsuspendable functions.

 From my research into them, what I've concluded is you have leaf, 
mergable and non-mergable functions.

Leaf of course is a coroutine, mergable gets merged into a given 
coroutine or can be used as non-mergable, and of course non-mergable 
which is just regular D functions that we have now.

And of course you can't access TLS in a fiber/coroutine as they could 
move between threads, although in saying that there are reasons why you 
shouldn't do that due to the way system resources like locks work.

Certainly desirable thing to have, but alas its only QoL, not memory 
safety or makes linking possible so that is so far on the back burner 
I'm not thinking about how to actually get that in.


More information about the Digitalmars-d mailing list