News for hackers. Stuff that matters.
Re:Practical Go: Real-world advice for writing maintainable ... by bpicolo on Thursday February 21, 2019 @09:13PM (#19222544)
> For a local variable, the name i conveys as much information as index or idx and is quicker to read

This is only true because i is a specific, common abbreviation for index. When writing arbitrary glue code, a single letter variable would be a meaningless abbreviation without shared context. If you encounter "i" and it doesn't mean "index of a for loop", you're going to be taking additional time parsing meaning.

Re:Practical Go: Real-world advice for writing maintainable ... by 12298765 on Friday February 22, 2019 @02:03AM (#19223662)
An example where I disagree, and use 1-letter names daily: arrow functions in both Java and JS.

`usersList.stream().forEach(u -> someSet.add(u))`

It's immediately obvious that u is a user in usersList. I realize that it's debatable if u is really more readable than spelling out user, but I prefer it, and I don't think anyone is going to be confused by it. If the chain does get really long, also, I will spell it out explicitly.

Re:Practical Go: Real-world advice for writing maintainable ... by irishsultan on Friday February 22, 2019 @05:16AM (#19224273)
Shouldn't you be able to write that as `usersList.stream().forEach(someSet.add)`

For Javascript at least that would work.

Re:Practical Go: Real-world advice for writing maintainable ... by leshow on Friday February 22, 2019 @09:04AM (#19225347)
I haven't written Java since like java 5, but I believe java 8 has syntax for this as well:

`usersList.stream().forEach(someSet::add)`

Re:Practical Go: Real-world advice for writing maintainable ... by bpicolo on Friday February 22, 2019 @09:49AM (#19225746)
Sure, for a lambda I think it’s arbitrary. For larger functions / classes it matters