November 04, 2021

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").

November 04, 2021

On Thursday, 4 November 2021 at 04:19:35 UTC, Andrey Zherikov wrote:

>

Is it possible to enhance the deprecation mechanism that we currently have through deprecated attribute in a way that the

Good Idea ,helps auto patch into new version.