News for hackers. Stuff that matters.
Re:Error Handling in Go (2016) by stouset on Friday April 05, 2019 @11:02PM (#19588924)
More importantly, this will take me a minute to read and two minutes to make sure it’s doing the right thing every time I encounter it somewhere new.

I don’t think I will ever understand why so many go advocates seem so openly hostile to encapsulation. If go had used C-style for loops, I swear there would be people here defending the decision saying:

    sum := 0
    for (i := 0; i <= len(a); i++) {
        sum = sum + a[1]
    }
“See? Only four lines. What’s the big deal? It took me literally thirty seconds to write.”
Re:Error Handling in Go (2016) by stouset on Saturday April 06, 2019 @01:26PM (#19591849)
Did you immediately notice the bug in my above code? If not, hopefully you get my point.

Compared to

    array.sum()
was the above code more or less clear? Is it more or less prone to bugs? When reading, which code will you have a quicker understanding of the intent?

And if you did notice the the first bug, did you notice the second bug?

Re:Error Handling in Go (2016) by kortex on Saturday April 06, 2019 @03:39PM (#19592595)
Well played. I noticed neither until you pointed them out. Certainly would have missed it in a code review.