DIP 1030--Named Arguments--Community Review Round 1 Discussion

Adam D. Ruppe destructionator at gmail.com
Sun Feb 9 18:45:10 UTC 2020


On Sunday, 9 February 2020 at 18:32:45 UTC, Steven Schveighoffer 
wrote:
> Now, you call the function with foo(milliseconds: 5), and 
> inside the function, the parameter is named 'a'.

We can always just `alias a = milliseconds;` inside the function.

Changing inside alone is easy, though changing the outside one is 
a bit trickier. We can't overload on name alone so no way to use 
function-level `deprecated` messages. But maybe a pragma or 
deprecated alias syntax on names could be enough.

Users changing is easy too, just the lib implementer wanting to 
provide some range of compatibility would probably want the 
deprecated alias to keep working for a while. So we might 
consider adding such a thing.

void foo(int milliseconds deprecated alias ms) {}

wow ugly syntax lol but i think the grammar would allow that and 
now the param has two names for inside and outside and gives a 
place for us to put a message.

but i kinda suggest just not worrying about it until experience 
proves this is a real problem that needs to be solved.


More information about the Digitalmars-d mailing list