Hacker News new | ask | show | jobs
by kevin_thibedeau 1740 days ago
For C* langs you can just insert a block comment with the arg name:

  my_func(/*a_bool_flag*/ true, yadda);
1 comments

The 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.
Linters 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

[1]: https://errorprone.info/bugpattern/ParameterName