5 ms·
But without optional parameters, what is the point of named parameters? Hopefully most functions have a limited number of parameters, with these parameters bein
by Thiez 8y ago
But without optional parameters, what is the point of named parameters? Hopefully most functions have a limited number of parameters, with these parameters being in a somewhat logical order, and the names of the values passed to the functions hinting at their purpose. In addition, more and more IDEs have the ability to display the parameter names. Some display them at all times, other on mouse-over.
I write a lot of C#, and find I only used named parameters when a function has default parameters. Even then I prefer to avoid writing such functions myself, and Microsoft seems to agree [1].
[1]: https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1026-default-parameters-should-not-be-used?view=vs-2017 https://docs.microsoft.com/en-us/visualstudio/code-quality/c...
- wtetzner 8y ago> But without optional parameters, what is the point of named parameters? The point of named parameters is not having to remember the order parameters come in, especially in cases where the parameters are of the same type. Also, IDE's aren't the only places where you read code.