3 ms·
For C* langs you can just insert a block comment with the arg name: my_func(/*a_bool_flag*/ true, yadda);
by kevin_thibedeau 5y ago
For C* langs you can just insert a block comment with the arg name:
my_func(/*a_bool_flag*/ true, yadda);
- city41 5y agoThe downside to this approach is it often doesn't survive refactors. People change the method signature, update call sites, and often ignore the comments. Named parameters avoid this downside, it's a real shame named parameters are not more common in languages.
- emptysea 5y agoLinters can check for this sort of thing, for example Error Prone[0] has a lint[1] for this. Totally agree this is better to be in the language proper so we don't need this extra tooling. [0]: https://errorprone.info https://errorprone.info [1]: https://errorprone.info/bugpattern/ParameterName https://errorprone.info/bugpattern/ParameterName