On 2009-08-08 09:17:28 -0400, Andrei Alexandrescu
<[email protected]> said:
Great description.
FWIW, I am trying to convince Walter to not reclaim memory in delete,
but instead only call destructors. D continues C++'s mistake of
conflating lifetime termination with memory reclamation.
I don't see how this changes anything. Instead of accessing a
deallocated object, you'll access a finaized but not yet deallocated
object. In both cases, it's a bug.
Wouldn't it be better to have a system to track unique pointers? If you
knew that no other pointer points to a given object or memory block,
you can finalize and deallocate it safely. In fact, the current
semantics of a scope object assume that the programmer will not leave
any dangling pointers at the end of the scope, so it's already assuming
uniqueness, just not enforcing it.
--
Michel Fortin
[email protected]
http://michelf.com/