www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Deprecation of 'clear()'

reply "Mike" <none none.com> writes:
I ran accross the following statement in the runtime's source 
code (object.di).

// Scheduled for deprecation in December 2012.
// Please use destroy instead of clear.
alias destroy clear;

I don't see 'clear' mentioned in the spec and I searched through 
all of the runtime and phobos code and could not find a single 
instance of it being used.  Did it ever 'really' exist?

I would like to update the deprecated features page 
(http://dlang.org/deprecate.html), but I don't have the 
historical perspective to do it properly, so I'm asking:

1.  When was it introduced?
2.  When was the decision made to deprecate it?
3.  Was there a deprecation process and timeline decided on?  If 
so, what was it?
4.  Is it safe to remove from object.di and kill it officially?

If you know, fell free to do a pull on the deprecated features 
page, or let me know on this thread, and I'll do the pull.

Thanks for the help,
Mike
Mar 26 2014
next sibling parent reply Nick Treleaven <ntrel-public yahoo.co.uk> writes:
On 27/03/2014 04:24, Mike wrote:
 I ran accross the following statement in the runtime's source code
 (object.di).

 // Scheduled for deprecation in December 2012.
 // Please use destroy instead of clear.
 alias destroy clear;

 I don't see 'clear' mentioned in the spec and I searched through all of
 the runtime and phobos code and could not find a single instance of it
 being used.  Did it ever 'really' exist?
Yes, but it was just renamed destroy and the alias added. It was listed in the 'changed features' part of the changelog for 2.060: http://dlang.org/changelog.html#new2_060
 I would like to update the deprecated features page
 (http://dlang.org/deprecate.html), but I don't have the historical
I think that page is for language deprecations rather than Phobos ones.
 perspective to do it properly, so I'm asking:

 1.  When was it introduced?
 2.  When was the decision made to deprecate it?
 3.  Was there a deprecation process and timeline decided on?  If so,
 what was it?
 4.  Is it safe to remove from object.di and kill it officially?
Does it cause a problem to keep it there? Any problems have to be weighed against the breakage of existing code.
 If you know, fell free to do a pull on the deprecated features page, or
 let me know on this thread, and I'll do the pull.

 Thanks for the help,
 Mike
Mar 27 2014
parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 27 Mar 2014 08:12:29 -0400, Nick Treleaven  
<ntrel-public yahoo.co.uk> wrote:

 On 27/03/2014 04:24, Mike wrote:
 I would like to update the deprecated features page
 (http://dlang.org/deprecate.html), but I don't have the historical
I think that page is for language deprecations rather than Phobos ones.
clear is part of the language, and runtime. Not phobos. It's akin to string.
 perspective to do it properly, so I'm asking:

 1.  When was it introduced?
Before TDPL came out. It was intended somewhat to do the job of delete (a to-be-deprecated feature), but without the memory deallocation.
 4.  Is it safe to remove from object.di and kill it officially?
Does it cause a problem to keep it there? Any problems have to be weighed against the breakage of existing code.
Yes, typically, one imagines calling clear on a container to clear all the elements, not destroy the container itself. The advent of UFCS makes this prone to confusion. That being said, I don't know the deprecation schedule, if there is one. -Steve
Mar 27 2014
prev sibling parent "Mike" <none none.com> writes:
On Thursday, 27 March 2014 at 04:24:45 UTC, Mike wrote:

Code pull request:
https://github.com/D-Programming-Language/druntime/pull/757

Documentation pull request:
https://github.com/D-Programming-Language/dlang.org/pull/531
Mar 27 2014