Zulip Chat Archive

Stream: std4

Topic: deprecated annotation


James Gallicchio (Jul 07 2023 at 17:52):

We've talked about it before, but any thoughts on adding a @[deprecated] annotation with linter support to warn at the use site (probably with text that describes the new name to use?)? Thinking about it cuz of std4#177, which includes breaking changes for mathlib that would be easy to fix downstream if there were nice linter messages saying what the new names are.

Kyle Miller (Jul 07 2023 at 17:55):

Have you tried using @[deprecated foo]? It seems to do everything you're suggesting, except perhaps linting.

Ruben Van de Velde (Jul 07 2023 at 17:55):

We have this in mathlib; I thought it came from core or std already

Kyle Miller (Jul 07 2023 at 17:55):

Yeah, it's in core

James Gallicchio (Jul 07 2023 at 17:55):

oh very cool

James Gallicchio (Jul 07 2023 at 17:59):

I would prefer if it allowed strings instead of just (known) identifiers... Maybe I try to find the core implementation.

Kyle Miller (Jul 07 2023 at 18:02):

I'm not sure how that would work -- you need to have a declaration around with the old name so that you can resolve the name downstream to be able to give the warning.

James Gallicchio (Jul 07 2023 at 18:03):

The warning can just include the string instead of the "use whatever instead" message

James Gallicchio (Jul 07 2023 at 18:04):

vscode displays the warning nicely so I don't think any additional linter is necessary :)

James Gallicchio (Jul 07 2023 at 18:09):

oh, @Kyle Miller I meant having something like @[deprecated "See patch notes"] def foo, for when there is no new symbol to substitute for the deprecated one


Last updated: Dec 20 2023 at 11:08 UTC