News for hackers. Stuff that matters.
Re:Practical Go: Real-world advice for writing maintainable ... by apoorvgarg on Thursday February 21, 2019 @04:23PM (#19220703)
Regarding single-letter variables, mathematical functions might be an exception. I think writing func gcd(a, b int) int {...} is better than other alternatives. There is simply no need to assign any more meaning to the arguments other than their type.
Re:Practical Go: Real-world advice for writing maintainable ... by Cthulhu_ on Friday February 22, 2019 @04:12AM (#19224041)
Maybe if you - and more importantly, everyone that will read the code in the future - are comfortable with domain-specific expressions like that. It depends on the audience really.

As an extreme example, scalaz is similarly a very specialized DSL. Or in my personal experience, functional constructions like map, flatMap, foldLeft and reduce (which I never learned in school).

Re:Practical Go: Real-world advice for writing maintainable ... by bnolsen on Thursday February 21, 2019 @10:32PM (#19222878)
no, it's not. bigger deal is that single letter vars make it much harder to search for variable usage in files using arbitrary editors.
Re:Practical Go: Real-world advice for writing maintainable ... by coldtea on Friday February 22, 2019 @12:37AM (#19223380)
Don't use arbitrary editors, or editors that don't support "search for standalone identifier" (e.g. surrounded by space, in (), with ; after etc.".
Re:Practical Go: Real-world advice for writing maintainable ... by apoorvgarg on Thursday February 21, 2019 @11:36PM (#19223163)
What would be the signature of your gcd function ?
Re:Practical Go: Real-world advice for writing maintainable ... by base698 on Thursday February 21, 2019 @11:59PM (#19223259)
Numerator, denominator?
Re:Practical Go: Real-world advice for writing maintainable ... by mrgriffin on Friday February 22, 2019 @04:54AM (#19224203)
For GCD? I would find those names very misleading since semantically the order of the arguments to GCD is irrelevant (even if in the implementation you typically mod by b there's no reason you couldn't mod by a).
Re:Practical Go: Real-world advice for writing maintainable ... by sacado2 on Friday February 22, 2019 @05:36AM (#19224351)
This is not mathematically correct. Those names would be pretty misleading, actually.
Re:Practical Go: Real-world advice for writing maintainable ... by coldtea on Friday February 22, 2019 @12:37AM (#19223384)
Good luck with any bigger equation then