3 ms·
Name parameters can benefit when you are reviewing code, beyond just when writing code; it makes clear what every parameter is for as you scan through code. Thi
by mjrpes 6y ago
Name parameters can benefit when you are reviewing code, beyond just when writing code; it makes clear what every parameter is for as you scan through code. This is most helpful with function calls with lots of optional parameters.
Another benefit is name parameters can replace the current pattern of passing a "parameter bag" array. Code checkers can catch mistakes here at time of compile, rather than runtime.
The negative of named parameters as implemented here is that the names are defined by the variable names in the function definition. So, renaming variables in the function definition will break code that calls the function using named parameters.