Mention methods and fix text

This commit is contained in:
Aviral Goel 2024-07-12 11:10:21 -07:00
parent bcf3b321dd
commit 8a8f0480d0

View file

@ -15,16 +15,16 @@ This RFC proposes the introduction of a `@deprecated` attribute to mark deprecat
## Design ## Design
The `@deprecated` attribute can take upto two named string parameters. The parameters affect the warning message issued by the linter. The `reason` parameter gives the reason for deprecation and the `use` parameter gives the name of the function that should be used in lieu of the deprecated function. The following table shows the warning message issued by the different styles of this attribute when used on a function named `foo`. The `@deprecated` attribute can only be used on named functions and methods. It does not apply recursively to the functions defined within the lexical scope of the attributed function. It can take upto two named string parameters. The parameters affect the warning message issued by the linter. The `reason` parameter gives the reason for deprecation and the `use` parameter gives the name of the function that should be used in lieu of the deprecated function. The following table shows the warning message issued by the different styles of this attribute when used on a function named `foo`.
| Style | Message | | Style | Message |
| ----------------------------------------------- | -----------------------------------------------------------------------| | ----------------------------------------------- | -----------------------------------------------------------------------|
| `@deprecated` | `"Function 'foo' is deprecated."` | | `@deprecated` | `"Function 'foo' is deprecated."` |
| `@[deprecated {reason = string}]` | `"Function 'foo' is deprecated. <reason>"` | | `@[deprecated {reason = string}]` | `"Function 'foo' is deprecated. <reason>"` |
| `@[deprecated {use = string}]` | `"Function 'foo' is deprecated. Use '<use>' instead."` | | `@[deprecated {use = string}]` | `"Function 'foo' is deprecated, use '<use>' instead."` |
| `@[deprecated {reason = string, use = string}]` | `"Function 'foo' is deprecated. Use '<use>' instead. <reason>` | | `@[deprecated {reason = string, use = string}]` | `"Function 'foo' is deprecated, use '<use>' instead. <reason>` |
The `@deprecated` attribute can only be used on named functions and methods. It does not apply recursively to the functions defined within the lexical scope of the attributed function. If `foo` is a member of class `bar`, the warning messages above will start as `"Member 'bar.foo' is deprecated ...`.
## Related Work ## Related Work