digitalmars.D - delete & its deprecation
- bauss (3/3) Oct 27 2017 Are there any plans to completely remove the delete keyword so
- Jonathan M Davis (17/20) Oct 27 2017 It's been the plan for ages that delete was to be deprecated, but no one...
- 12345swordy (5/27) Oct 28 2017 It certainly doesn't help when there are bugs regarding destroy
Are there any plans to completely remove the delete keyword so members of ex. a class can be called delete? Or is there still code within DMD or Phobos that uses it?
Oct 27 2017
On Friday, October 27, 2017 12:30:58 bauss via Digitalmars-d wrote:Are there any plans to completely remove the delete keyword so members of ex. a class can be called delete? Or is there still code within DMD or Phobos that uses it?It's been the plan for ages that delete was to be deprecated, but no one has ever bothered to do it. Part of the problem has been that while it was possible to construct a class into memory allocated with something other than new and than destroy it later, it was actually pretty difficult to get right. If it weren't for that, I probably would have pushed for its removal ages ago. However, now that we have std.experimental.allocator, things have changed a bit, and it should be far more reasonable to get rid of delete. But still, someone has to actually go and deprecate it, and I think that it's more or less been forgotten. Nothing in Phobos uses delete, and it looks like the only place that uses delete in druntime is some unit tests. I doubt that any of the core D developers have done anything with delete in years, which would be part of why it's easily forgotten. I know that I tend to forget that it's even part of the language. - Jonathan M Davis
Oct 27 2017
On Friday, 27 October 2017 at 19:03:01 UTC, Jonathan M Davis wrote:On Friday, October 27, 2017 12:30:58 bauss via Digitalmars-d wrote:It certainly doesn't help when there are bugs regarding destroy function. -Alexander HeistermannAre there any plans to completely remove the delete keyword so members of ex. a class can be called delete? Or is there still code within DMD or Phobos that uses it?It's been the plan for ages that delete was to be deprecated, but no one has ever bothered to do it. Part of the problem has been that while it was possible to construct a class into memory allocated with something other than new and than destroy it later, it was actually pretty difficult to get right. If it weren't for that, I probably would have pushed for its removal ages ago. However, now that we have std.experimental.allocator, things have changed a bit, and it should be far more reasonable to get rid of delete. But still, someone has to actually go and deprecate it, and I think that it's more or less been forgotten. Nothing in Phobos uses delete, and it looks like the only place that uses delete in druntime is some unit tests. I doubt that any of the core D developers have done anything with delete in years, which would be part of why it's easily forgotten. I know that I tend to forget that it's even part of the language. - Jonathan M Davis
Oct 28 2017