Deprecated Keyword

Overview:

Addition of the keyword 'deprecated' to indicate that a method or object should no longer be used.

Proposed by:

Jeff Walker (language designer)

Experts to Contact:

jwalker@cs.oberlin.edu

Status: Being Considered

Reason:

Java has shown the use of the deprecated concept through its doc comments. However these are the only comments that affect how the compiler compiles code. For that reason it seems it should be in the language, in that way the compiler need never deal with comments.

Description:

The deprecated keyword could be used as a basic modifier before an object to indicate that it shouldn't be used any more causing a warning. Alternatively it could be provided with a parameter specifying a level or degree of deprecation. For example:

When dealing with virtual objects an overriding object may not have a higher deprecation level but may have a lower one. If levels are put in it could be used without the level to indicate that it was the same level has what it was overriding.

Assuming the acceptance of documentation comments. A @deprecated tag would be added. It would be followed by a description of why something was deprecated and what should be done instead.

Example:

module
{ public class Entry
{ /**
* Method to access the text
* @deprecated use getText() instead
*/
public deprecated getName() -> string
{ return text;
}
}
}


jwalker@cs.oberlin.edu