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

Steven Schveighoffer schveiguy at gmail.com
Sun Feb 9 19:09:18 UTC 2020


On 2/9/20 1:45 PM, Adam D. Ruppe wrote:
> 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.

Agree with all of this.

-Steve


More information about the Digitalmars-d mailing list