Review What "deprecate" Metadata Can Meaningfully be Applied To
Due to our non-existent metadata validation, the Slice compiler allows you to put ["deprecate"] on pretty much anything.
But, what this actually affects is very language dependent, and I think we should make it more consistent,
preferably by handling it more gracefully in more languages.
For example, in C++, ["deprecate"] only has an effect on operations and interfaces.
But I don't see a reason not to handle this for structs, exceptions, etc as well. We could generate [[deprecated]] on them all the same.
Whereas in C# and Java, we correctly handle this for all kinds of stuff, operations, enums, structs, everything you'd expect.
We settled on the following:
Deprecate can be applied to:
- interfaces (only affects the generated proxy)
- operations (only affects the generated proxy function)
- classes
- exceptions
- structs
- sequences
- dictionaries
- enums
- enumerators
- constants
- data members
Deprecated cannot be applied to:
- units (file-level)
- modules
- parameters
Note that this matches the behavior of IceRPC: https://github.com/icerpc/slicec/blob/6d4e991aa59beb07b4394dcef398354784f07eef/src/grammar/attributes/deprecated.rs#L20-L32
This has been implemented in the Slice Parser, and in C++, but the following languages still need to be fixed:
- [ ] C#
- [ ] Java
- [ ] JavaScript
- [ ] MATLAB
- [ ] PHP
- [ ] Python
- [ ] Ruby
- [ ] Swift