DIP 1030--Named Arguments--Community Review Round 1 Discussion
Jon Degenhardt
jond at noreply.com
Sun Feb 9 00:56:15 UTC 2020
On Friday, 7 February 2020 at 03:33:26 UTC, Jonathan M Davis
wrote:
> Well, I'll say again that I don't like the idea of having named
> arguments in the language, because it makes the parameter names
> part of the API, resulting in yet more bikeshedding and yet
> another thing that can't be changed without breaking existing
> code. Once in a while, named arguments may be useful, but for
> the most part, they're useful because a function has way too
> many parameters, in which case, the function should have been
> designed differently.
I am in definitely in favor of named arguments in the language.
Overall I think the benefits of this specific DIP proposal
outweigh the negatives identified.
That said, having parameter names automatically become part of a
function's API is a meaningful downside. (Specifically, that a
parameter name cannot be changed without risk of breaking
existing callers.) The reasons are likely self-evident, but to
spell out my thoughts:
* Additional design time when initially creating functions (good
names are hard).
* More time required from code reviewers (both open-source and
corporate).
* Barrier to incrementally improving a function (and
documentation) over-time by improving the quality of the
parameter names.
The above are more reflective of waterfall than an agile
approach, a disadvantage in situations where a more iterative
development style is preferable.
Another part of the equation is simply that when I'm developing a
function, I usually have a pretty good idea whether named
arguments are going to be a material benefit. In those cases I'm
willing to spend time on the quality of the names.
I do think the benefits of the DIP outweigh this concern.
However, if there is a reasonable way to allow the developer of a
function to control whether the function can invoked via named
arguments that would be an enhancement worth considering. This
control need not be at the level of each individual parameter. It
could be at the function level.
--Jon
More information about the Digitalmars-d
mailing list