News for hackers. Stuff that matters.
Re:Practical Go: Real-world advice for writing maintainable ... by mntmoss on Thursday February 21, 2019 @06:12PM (#19221548)
Dense code that benefits from dense variables(which describes a lot of "pure algorithms" work) I often approach by aliasing the variables to shorter ones. It's all in the same body so the context is not especially hard to lose.
Re:Practical Go: Real-world advice for writing maintainable ... by ivanhoe on Friday February 22, 2019 @08:51AM (#19225227)
IMHO short is OK as long as the name makes sense and is easy to connect to the real meaning. For instance "msg" is perfectly valid name for a message var, and even "m" in some short snippet of code is obvious, but calling it "a" or "x" or something completely unrelated like that is a bad idea. In matter of fact calling it something too neutral like "data" can also be as bad if it's not clear which data you mean. Context is everything in making it easy to understand.