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

>No enums? [...] We're stuck with magic numbers?

In go you don't strictly need magic numbers because you can define constants:

    type Status int
    const (
        IoProblem Status = iota // we start at zero and go down from there
        JsonParse
        ...
    )
The problem is that there is no exhaustiveness with these constant groups. The type Number is not a closed set of just IoProblem and JsonParse like an enum in C. It is just an int.


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

Search: