C++17

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 27 12:28:42 PST 2016


On Wednesday, 27 January 2016 at 14:22:18 UTC, Shachar Shemesh 
wrote:
> I bring it up every time the subject comes up, in the hopes 
> that at some point it will sink in.
>
> No, D is not capable of doing it already. Without 100% reliable 
> destructors, RAII is simply not implementable.
>
> D's destructors are not guaranteed to run on 100% of fully 
> initialized structs, which means that a RAII container has no 
> way to make sure its resource is actually freed. It is up to 
> the implementer. This eradicates almost all of the utility RAII 
> was meant to provide.
>
> Shachar

The only time it may not run, it is when these are collected by 
the GC. Which is not a problem if you want to use RAII, as in 
C++, to not use a GC.

What need to sink in is that, when it come to RAII, you have all 
the same tool as in C++ and can do all the same shit (modulo 
internal pointers), as unasfely as in C++.



More information about the Digitalmars-d mailing list