4 ms·
Idiomatic Go is influenced by the style of its creators; Russ Cox explicitly endorses the view that "A name's length should not exceed its information content..
by nemo1618 8y ago
Idiomatic Go is influenced by the style of its creators; Russ Cox explicitly endorses the view that "A name's length should not exceed its information content...Global names must convey relatively more information, because they appear in a larger variety of contexts." (https://research.swtch.com/names https://research.swtch.com/names). Accordingly, Go's standard library is full of one- and two-letter variable names, e.g. https://golang.org/src/math/big/nat.go#L1127 https://golang.org/src/math/big/nat.go#L1127. I think one-letter method receivers are fine; the scope is limited, the receiver is referenced frequently enough to make long names annoying, and Go's style guide strongly encourages using consistent receiver names across methods ("go vet" will even complain about it).