News for hackers. Stuff that matters.
Re:Practical Go: Real-world advice for writing maintainable ... by sacado2 on Friday February 22, 2019 @04:57AM (#19224212)
It is problematic for readability reasons as long as you are making complex expressions:

    configuration := NewConfiguration()
    configuration[word] = parameters[values[line][column]] - parameters[values[column][line]]
vs

    conf := NewConfig()
    conf[w] = params[vals[i][j]] - params[vals[j][i]]
It takes your brain more time to parse the first line. Now, there is an obvious limit, this is probably too much

    c[w] = p[v[i][j]] - p[v[j][i]]
unless maybe the scope of the vars is very limited.
Re:Practical Go: Real-world advice for writing maintainable ... by dagw on Friday February 22, 2019 @06:33AM (#19224522)
In your example I would compromise with:

    conf[w] = params[vals[line][column]] - params[vals[column][line]]
or even:

    conf[w] = params[vals[l][c]] - params[vals[c][l]]
if you really want to save a couple of characters. Confusing which loop index is indexing which dimension is far too easy.
Re:Practical Go: Real-world advice for writing maintainable ... by Casperin on Friday February 22, 2019 @05:59AM (#19224427)
The first version was too long to fit on the screen for me. Reading the second I missed the swapping of `i` and `j` -- only noticing it when I went back to the first version to figure out which parts of line I would assign to something if I were to rewrite the code.