Hacker News new | past | comments | ask | show | jobs | submit login

The problem with your solution is:

1. If the verified field is not set, your program blows up at runtime. I don't think it's acceptable for programs to blow up at runtime for errors that can be caught at compile time.

2. Your example still has the same problem when it comes to `MaxMessageBytes`, what if I really meant to set it to 0? The `WithDefaults` function would eat that. You could use a pointer, but then that just complicates the API (you need to do new(int) as a separate variable and assign it




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

Search: