DIP 1020--Named Parameters--Community Review Round 1
Walter Bright
newshound2 at digitalmars.com
Wed Apr 10 20:03:36 UTC 2019
On 4/9/2019 12:46 PM, Seb wrote:
> It allows library authors optionally to control exactly which parameters are
> positional and which are keyword-only and which are both.
>
> [1] https://www.python.org/dev/peps/pep-0570/
Note that there is a way to require positional-only in D:
int foo(int);
I.e. leave off the parameter name.
It works when there's a separate .di file from the implementation .d file (which
would have the names). It won't work for template parameters.
As for renaming parameters,
void foo(T oldname);
becomes:
void foo(T)(T oldname) { return foo(newname : oldname); }
void foo(T newname);
Yeah, it's a little awkward, but if you're renaming parameters you've got
awkward backwards compatibility issues anyway.
More information about the Digitalmars-d
mailing list