Hacker News new | ask | show | jobs
by nvader 3801 days ago
My practice has usually been to ensure that the zero values of the types ARE a sane default for a struct if that struct is public and may be instantiated by a client. It sometimes involves flipping the semantics of some Boolean values around.

That, and judicious use of a New() function to construct and initialize types, help make up for the lack of default attributes in structs.