[Issue 18505] New: delete deprecation message is misleading
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 23 14:44:23 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18505
Issue ID: 18505
Summary: delete deprecation message is misleading
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: diagnostic
Severity: minor
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: schveiguy at yahoo.com
Currently, the dprecation message for delete says:
Deprecation: The delete keyword has been deprecated. Use object.destroy()
instead.
However, this is not complete. In order to fully replace the mechanism of
delete, you must call GC.free on the pointer.
In many cases, people have used delete and expect the memory to be freed.
Telling them that all they have to do is use destroy is not going to satisfy.
I suggest (similar to Bearophile's suggestion in issue 9433):
use object.destroy (and optionally core.memory.GC.free) instead.
There is also this new function (unreleased as of 2.079, but in druntime
already): https://dlang.org/phobos-prerelease/core_memory.html#.__delete
--
More information about the Digitalmars-d-bugs
mailing list