Bug 19214 – Support object.destruct() for efficient (and correct!) destruction

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-09-03T21:17:48Z
Last change time
2018-11-30T12:32:38Z
Assigned to
No Owner
Creator
Manu

Comments

Comment #0 by turkeyman — 2018-09-03T21:17:48Z
Please consider adding an object.destruct() function beside object.destroy() to perform efficient destruction. Not all instances of destruction should pay the code of re-initialisation. Language complexity surrounding destruction makes direct calls to __dtor/__xdtor too complex for the user to understand and implement correctly, as evidenced by a myriad of OSS libs that have attempted, and failed.
Comment #1 by turkeyman — 2018-09-04T00:03:24Z
Comment #2 by github-bugzilla — 2018-11-30T12:32:37Z
Commit pushed to master at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/0fe98729034a2d7bc76bfc81c25e9dbd1f3d560a Fixes Issue 19214 - Support object.destruct() for efficient (and correct!) destruction