Discussion Thread: DIP 1030--Named Arguments--Final Review

Steven Schveighoffer schveiguy at gmail.com
Thu May 14 16:59:38 UTC 2020


On 5/14/20 12:18 PM, Seb wrote:
> On Thursday, 14 May 2020 at 13:33:30 UTC, Steven Schveighoffer wrote:
>> However, one COULD provide a prototype simply for renaming parameters 
>> (without implementation). I don't think you even need a specialized 
>> extern(D, argNames) marking, if the compiler will just prefer 
>> non-deprecated matches over deprecated ones.
> 
> Yeah, I that would work.
> Though the advantage of being able to write a custom body is that now 
> you have a lot more freedom in case the new method differs from the old 
> one by more than argument changes (e.g. semantic or ordering changes):
> 
> ---
> add(int x_s, int y_s) { ... }
> @deprecated extern(D, "argNames") add(int x_ms, int y_ms) { add(x_ms * 
> 1000, y_ms * 1000); }
> ---

I don't think this works, because the parameter names are optional.

In other words, add(1, 2) is going to silently do something else, which 
defeats the purpose of the deprecation.

A deprecation of semantic meaning or position needs to be handled via a 
different function name (like it is today).

Which means a deprecated prototype is all that is needed in the case of 
changing parameter names.

-Steve


More information about the Digitalmars-d mailing list