// denisdefreyne.com / notes
Last revised:
April 2021

Artificial slowdown as a way to guide deprecation

On Twitter, I suggested a new way of handling deprecation:

Suggestion for handling deprecation: When deprecating a function, add a “sleep 0.1” to it, and double that interval every month.

While certainly not intended as a fully serious suggestion, it might have merit in some situations.

In particular, invoking deprecated commands on a command line could benefit from an artificial slowdown.

Artificial slowdown as a deprecation method in libraries is likely to be counterproductive, as library calls might invoke deprecated functions frequently, and even a tiny artificial slowdown could thus make applications unacceptably slow.

Perhaps a method to cap this artificial slowdown using a rate-limiting approach could work, but perhaps then we’re overthinking things.

In any case, any artificial slowdown as a deprecation method should make it absolutely clear where it comes from, e.g. with a warning message printed to stderr.

References

Defreyne, Denis. “@Argorak Suggestion for Handling Deprecation: When Deprecating a Function, Add a ‘Sleep 0.1’ to It, and Double That Interval Every Month.” Tweet. @ddfreyne, January 10, 2021. https://twitter.com/ddfreyne/status/1348336048686985219.