Is it possible to enhance the deprecation mechanism that we currently have through deprecated
attribute in a way that the source code can provide how the caller should look like to migrate off the deprecated API? Something like this:
void bar(string param)
{
}
deprecated("Use bar", (string[] args) => ["bar(", args.join(", "), ")"].join)
void foo(string param)
{
bar(param);
}
foo("text"); // Deprecation: function `foo` is deprecated - Use bar:
// bar("text")
Then DMD can have a special mode where it replaces deprecated code in place allowing easy migration to newer API, so foo("text")
is substituted with bar("text")
.