Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Mark clear as deprecated #757

Merged
3 commits merged into from
Apr 1, 2014
Merged

Mark clear as deprecated #757

3 commits merged into from
Apr 1, 2014

Conversation

JinShil
Copy link
Contributor

@JinShil JinShil commented Mar 27, 2014

This pull request follows up on a change in 2.060.0 (http://dlang.org/changelog.html#new2_060)

clear has been renamed to destroy, and clear (as an alias to destroy) has been scheduled for deprpecation.

It appears to be overdue given the following comment in the source code:

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

Its continued existence can cause confusion with other methods named 'clear' due to UFCS, and also causes confusion for students of D as can be witnessed here (http://forum.dlang.org/thread/ogpnmoyqbldexrmijexa@forum.dlang.org#post-ogpnmoyqbldexrmijexa:40forum.dlang.org)

Although it may be safe to eliminate it completely, this PR simply marks it as deprecated, so any existing uses of clear are flagged with warnings. clear can be eliminated aftter a couple of releases with this deprecation warning in place.

Accompanying documentation pull request to come shortly.

@@ -490,7 +490,7 @@ inout(V) get(K, V)(inout(V[K])* aa, K key, lazy inout(V) defaultValue)

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deprecated can take an optional message, so I suggest changing this to:

deprecated("Please use destroy instead.")

Also you could change it to use new-style alias syntax:

deprecated("Please use destroy instead.")
alias clear = destroy;

@ntrel
Copy link
Contributor

ntrel commented Mar 30, 2014

LGTM so long as Phobos + druntime don't trigger the message.

@ghost
Copy link

ghost commented Mar 30, 2014

@andralex: Are we ok to move forward with this?

@MartinNowak
Copy link
Member

It should be fine, I just enabled the autotester for this pull.

@@ -490,7 +490,8 @@ inout(V) get(K, V)(inout(V[K])* aa, K key, lazy inout(V) defaultValue)

// Scheduled for deprecation in December 2012.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the comment be updated?

I think the convention is to remove 6 months after deprecation.

@andralex
Copy link
Member

yah, let's

@ghost
Copy link

ghost commented Apr 1, 2014

Auto-merge toggled on

ghost pushed a commit that referenced this pull request Apr 1, 2014
Mark `clear` as `deprecated`
@ghost ghost merged commit ac239eb into dlang:master Apr 1, 2014
@jmdavis
Copy link
Member

jmdavis commented Apr 1, 2014

Yeah, it looks like I missed this one, because the message on it didn't match what I normally put on symbols marked as scheduled for deprecation. And we may want to keep it around later than October, since it's listed in TDPL, but it's long past time for it to be deprecated rather than just scheduled to be deprecated.

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants