6 ms·
You generally want newtypes as proofs that a value has gone through some validation.
by howinteresting 4y ago
You generally want newtypes as proofs that a value has gone through some validation.
- foldr 4y agoAnd what prevents you using them this way in Go? Just make a package and export a constructor function that does the validation.
- Tomis02 4y agoI think that was the author's point. You _can_ use them this way but it's a hassle and most people don't do it. The language itself doesn't protect you against zero-initialisation errors, even though it could.
- deleted 4y ago[deleted]