Discussion Thread: DIP 1030--Named Arguments--Final Review
jmh530
john.michael.hall at gmail.com
Wed May 13 00:28:21 UTC 2020
On Tuesday, 12 May 2020 at 21:03:34 UTC, 12345swordy wrote:
> [snip]
>
> If the user uses named arguments then that is by definition
> opt-in. It makes no sense for the developer to opt-in for
> named arguments as well.
>
> I had already made my case regarding the "opt-in" part of the
> discussion, by pointing out that c# has named arguments by
> default and you can't opt out of it.
>
> -Alex
The underlying worry is that the developer changes the names of
the parameters and user code that depends on the names not
changing breaks. When I say opt-in, I mean that the developer
opts-in to let the user be able to use them. In essence, they
would be acknowledging that these parameters will not have their
names changed without a clear path forward.
Not having programmed anything in C#, I wanted to double-check
how C#'s named arguments work. Even after the change in 7.2 [1],
C#'s named arguments are much more limited than what is in this
DIP. The way C#'s work is that you can have all of them named, or
you can put the named ones at the end or you keep the positional
arguments in the right place. The proposal in the DIP is more
flexible, as far as I can tell.
[1]
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-7.2/non-trailing-named-arguments
More information about the Digitalmars-d
mailing list