Escaping the Tyranny of the GC: std.rcstring, first blood

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 14 21:50:21 PDT 2014


I don't want to be the smart ass that did nothing and complains 
about what other did, but I'll be it anyway.

It doesn't look very scalable to me to implement various versions 
of modules with various memory management schemes. Inevitably, 
these will have different subtle variation in semantic, different 
set of bugs, it is twice as many work to maintain and so on.

Have you tried to explore solution where an allocator is passed 
to functions (as far as I can tell, this wasn't very successful 
in C++, but D greater metaprogramming capabilities may offer 
better solutions than C++'s) ?

Another option is to use output ranges. This look like an area 
that is way underused in D. It looks like it is possible for the 
allocation policy to be part of the output range, and so we can 
let users decide without duplication bunch of code.

Finally, concepts like isolated allow the compiler to insert free 
in the generated code in a safe manner. In the same way, it is 
possible to remove a bunch of GC allocation by sticking some 
passes in the middle of the optimizer (


More information about the Digitalmars-d mailing list