preparing for named arguments

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Wed Aug 28 21:13:45 UTC 2019


On Wednesday, 28 August 2019 at 04:13:06 UTC, Exil wrote:
>
> Parameter names should be more than single letters, for the 
> same reasons they shouldn't be single letters as variables and 
> function names. If you are looking at two overloads, and they 
> both just name their parameters after letters. It takes more 
> time to go and read the documentation, rather than being able 
> to differentiate the two based on their parameter names.
>
> I remember looking at some of the many bindings to C libraries, 
> either Posix, Windows, or Stdlib for C. Someone, out of the 
> goodness of their heart decided it was a good idea to name the 
> parameters "a", "b", "c". Thankfully D does not provide 
> documentation for bindings to C functions either. Triple 
> whammy. Instead of just getting the information as I was typing 
> the function (with auto complete) for the parameters names. I 
> had to go to the definition to see the documentation and spend 
> extra time reading it. Just to find out there was no 
> documentation for it. Then having to go and search the actual 
> documentation for it externally. I guess it just speaks to 
> immaturity of the standard library for phobos, where there are 
> many instances of parameters just being single characters 
> (including for bindings with no documentation) and (no less) 
> there are people arguing for it that it is fine.

+1 to proper naming. it would be good to have consistent naming 
with the purpose of parameter/property/variable, not just for 
phobos, but for dmd too. Trying to make sense in dmd code 
sometimes is leading to scrolling up and down just to see what 
variables are for, then back at the usage point with knowledge of 
what they are (which is not clear in all cases), you've already 
forgot what the code using those variables is doing.


More information about the Digitalmars-d mailing list