www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9137] New: A function that equals to "out of scope" action for manual lifetime management

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9137

           Summary: A function that equals to "out of scope" action for
                    manual lifetime management
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com



22:17:49 MSK ---
We already have `emplace` to create an object but there is not function to
destroy the object. Yes, we have `destroy` but it is "to reclaim non-memory
resources without compromising memory safety" (as Andrei said).

So I'd like to have a `destuct` function destroying its argument just like as
if it goes out of scope and, optionally, resetting object memory to it's
initial state.

The function is implemented here:
https://github.com/D-Programming-Language/phobos/pull/929

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 10 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9137




22:49:05 MSK ---
Also note, as we have no such function currently one can easily consider that
`destroy` is such function and use it thinking it works this way. And it is
very dangerous, see Issue 9139 for details.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 10 2012