Idiomatic D using GC as a library writer

Ali Çehreli acehreli at yahoo.com
Sun Dec 4 16:02:28 UTC 2022


On 12/4/22 06:27, Sergey wrote:

 > if it will be possible to write
 > library in D and use it from
 > C/++/Python/R/JVM(JNI)/Erlang(NIF)/nameYourChoice smoothly it will be a
 > win.

Years ago we tried to call D from Java. I realized that it was very 
tricky to introduce the calling thread to D's GC. D's GC needed to stop 
the world, which meant it would have to know what threads were running. 
You can never be sure whether your D library function is being called 
from a thread you've known or whether the Java runtime (or other user 
code) just decided to start another thread.

We failed and D was replaced with C++.

Ali



More information about the Digitalmars-d-learn mailing list