Addition of the keyword 'deprecated
' to indicate that a method or object should no longer be used.
Jeff Walker (language designer)
Experts to Contact: Status: Being ConsideredJava 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:
deprecated(1)
- warning generated that this object is deprecated.deprecated(2)
- error generated, must not use, but object still present for backwards compatibility to libraries etc.deprecated(3)
- error, object value not present (only a stub declaration to indicate that it once had been theirWhen 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;
}
}
}