On 26/01/16 11:33, deadalnix wrote:
On Tuesday, 26 January 2016 at 09:16:47 UTC, Ola Fosheim Grøstad wrote:
Would it be possible to make a fully compatible unique_ptr/shared_ptr
solution that acts as the default memory management scheme in D within
6 months?
Now if one want to use that, D is very capable of doing it already. Just
won't make it the default (like it is not the default in C++ either).
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