delete & its deprecation

Jonathan M Davis newsgroup.d at jmdavisprog.com
Fri Oct 27 19:03:01 UTC 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



More information about the Digitalmars-d mailing list