[Cake] single letter names

Pete Heist pete at heistp.net
Mon Jul 2 01:35:30 EDT 2018


> On Jul 2, 2018, at 12:00 AM, Dave Taht <dave.taht at gmail.com> wrote:
> 
> I assume l and r are left and right, but m, mb, a and so on are rather
> arbitrary.
> 
> I don't care about this enough to change it.
> On Sun, Jul 1, 2018 at 4:33 PM Toke Høiland-Jørgensen <toke at toke.dk> wrote:
>> 
>> Dave Taht <dave.taht at gmail.com> writes:
>> 
>>> at least a comment in the code would help.
>>> 
>>> https://lwn.net/Articles/758353/
>> 
>> I do believe you have commit access…

One of the Go founders (Andrew Gerrand) gave the rule of thumb that the greater the distance between a name’s declaration and its uses, the longer the name should be (https://talks.golang.org/2014/names.slide). There can be exceptions, but I rather like and prefer well chosen single letter names for locals in many cases due to less typing and that the structure can be understood more quickly. Comments as appropriate that help readers figure out why the particular letter was chosen are nice, of course, when it’s not obvious, but that’s just my $0.02… :)



More information about the Cake mailing list