I’m working on a large project and I’ve updated a method that’s used by almost all parts of the system; the method now takes another parameter.
I wanted to make the new parameter optional so that I don’t have to go and update everyone else’s code to make use of it, so I provide a default parameter.
Is there any way I can emit a compiler warning to state that relying on the default parameter is deprecated, only if they’re relying on it?
Instead of using a default parameter, you could try using an overloaded function, one that has the extra parameter and one that doesn’t, and mark the one without the extra parameter as deprecated. It can call through to the new function, passing in whatever default you want.