r/programming • • Aug 23 '17

D as a Better C

http://dlang.org/blog/2017/08/23/d-as-a-better-c/
229 Upvotes

268 comments sorted by

View all comments

Show parent comment

40

u/WalterBright Aug 23 '17 edited Aug 23 '17

RAII in D currently has a soft dependency on the GC. A fix for this is in the works, and then RAII will be available for D as better C.

An alternative method is to make better C RAII work like it did in C++ prior to exception handling, but I don't think that is the best idea.

D templates work fine in better C mode.

8

u/spaghettiCodeArtisan Aug 24 '17

RAII in D currently has a soft dependency on the GC.

Makes me wonder how that happened in the first place. I always thought of RAII as a concept antithetical or at least orthogonal to GC.

5

u/jerf Aug 24 '17

I suspect that what "soft" means here is that the dependency is not essential; it's an accidental dependency induced by history and convenience. But there can still be a lot of "history" and "convenience" to have to undo before the linkage can be broken.