2 ms·
There's a convention to prefer short (1-3 characters) abbreviated identifiers for trivial things. For example, a loop variable: i := 0 But a more complex
by atombender 3y ago
There's a convention to prefer short (1-3 characters) abbreviated identifiers for trivial things. For example, a loop variable:
i := 0
But a more complex thing might get a fuller name:
producer := NewProducer()
In the earlier case with the HTTP handlers, "r" and "w" are conventions. They appear so often that it's counterproductive to give them full names. People who read the code would be confused.
Before Go, I did a lot of Java and Ruby, and felt like you did, and went against the conventions. But the code I wrote back when I started with Go now looks foreign to me.