Deprecation of 'clear()'

Steven Schveighoffer schveiguy at yahoo.com
Thu Mar 27 05:43:17 PDT 2014


On Thu, 27 Mar 2014 08:12:29 -0400, Nick Treleaven  
<ntrel-public at 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


More information about the Digitalmars-d mailing list