On Sunday, 4 May 2014 at 16:13:23 UTC, Andrei Alexandrescu wrote:
On 5/4/14, 4:42 AM, "Marc Schütz" <[email protected]>" wrote:
But I'm afraid your suggestion is unsafe: There also needs to be a way to guarantee that no references to the scoped object exist when it is
destroyed.

Actually, it should be fine to call the destructor, then blast T.init over the object, while keeping the actual memory in the GC. This possible approach has come up a number of times, and I think it has promise. -- Andrei

Then accesses at runtime would still appear to work, but you're actually accessing something else than you believe you do. IMO, this is almost as bad as silent heap corruption. Such code should just be rejected at compile-time, if at all possible.

Reply via email to