Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The author didn't say it is a bug. The author just says this is a shortcoming of Go.


    For reasons it’s never really bothered me, but the *other* loop bug does bite me some times. This is the one where the loop values are values. 

    The common mistakes wiki lists the capture bug twice, but doesn’t mention this bug.
Yeah, I guess you're right, the author didn't call it a bug...


I believe the author doesn't mean it is a bug in the general sense. The author just means it is a shortcoming, and this shortcoming is surely fixable. The author provides a solution, but I think the zig way is better:

    for _, *player := range players {
        player.score = 0
    }


If they meant 'shortcoming', they would have used that word. They used the word 'bug' to describe the issue. Repeatedly.


> The author didn't say it is a bug.

The author's title literally refers to it as a bug.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: