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

If the caller of your interface does not specify a value for your enum, they have implicitly specified the zero value. Whether that’s desirable behavior or not is up to you. For most clients, this behavior can be surprising if the zero value is a meaningful one (i.e. one that implies an intentional choice).

IME it’s useful to explicitly define the zero value’s meaning as “UNSPECIFIED”, to simplify the problem of trying to guess if the client intended to pass a zero value.



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

Search: