DIP 1019--Named Arguments Lite--Community Review Round 1

Seb seb at wilzba.ch
Mon Feb 18 19:27:15 UTC 2019


On Monday, 18 February 2019 at 08:32:02 UTC, RazvanN wrote:
> On Sunday, 17 February 2019 at 21:04:23 UTC, Yuxuan Shui wrote:
>> [...]
>
> How about this: simply adding the ability to name the argument 
> when calling a function? Example:
>
> void rectangle(int width, int height) {}
>
> void main()
> {
>     rectangle(1, 2);
>     rectangle(width: 1, height: 2);
>     rectangle(height: 2, width: 1);
>     rectangle(width: 1, 2);    // error
> }
>


1) What about typos/wrong names?

rectangle(width: 1, hight: 2)

2) How will this deal with parameter renames / deprecation?

If (1) isn't checked, introducing this later would break a lot of 
code.


More information about the Digitalmars-d mailing list