Built-in RAII in D

Mike Parker via Digitalmars-d digitalmars-d at puremagic.com
Tue May 30 07:29:45 PDT 2017


On Tuesday, 30 May 2017 at 10:30:13 UTC, qznc wrote:

> Currently, a good answer is to direct people to the "Don't fear 
> the reaper" [0] article, but I feel it does not really address 
> all concerns of people. Concerns like:

That was the introductory post in what I hope will be a long 
series where many of those concerns *will* be addressed, though I 
don't have the breadth of knowledge to write them all. My next 
one is going to cover the basics of @nogc (looking like next 
week). I hope to have a few guest posters contributing to the 
series on topics I'm not well-versed in.

>
> * How much of Phobos does not work with @nogc? A good answer 
> would probably be case studies of larger programs/companies. 
> Does Weka use @nogc a lot?

Been reading my TODO list? I have a shortlist of people I plan to 
ask about a Phobos @nogc post. And I'm planning a series of 
company profiles where that sort of thing will probably be 
discussed. I had one company lined up to start before DConf, but 
it never panned out. But during DConf and since I've gotten some 
tentative commitments. I intend to kick that off in July.

> * How to work around the GC? The reaper article does not 
> mention RefCounted.

A future post will. I expect to have a few posts related to more 
specialized strategies (Atila's post on automem is in that vein). 
Currently, I'm planning a post about something I call 
"Terminator" (which is essentially RefCounted, but calling a 
`terminate` method rather than the destructor) to introduce the 
concept, and will talk about RefCounted there. But that's going 
to come after a post about how the GC interacts with destructors, 
and that will come after my @nogc post.

> * Limitations of @nogc? It does not prevent *another* thread to 
> call the GC, which might then stop the world. We have to 
> mention the trick to create threads which are not tracked by GC.
> * How good is the D GC? Will it improve in the foreseeable 
> future? Information about the performance of the current GC is 
> quite dated, although I guess not much has changed.

The GC implementation is another thing I hope to have a post 
about, but it will again require a guest author to write it.


> [0] https://dlang.org/blog/2017/03/20/dont-fear-the-reaper/




More information about the Digitalmars-d mailing list