This repository was archived by the owner on May 25, 2023. It is now read-only.
This repository was archived by the owner on May 25, 2023. It is now read-only.
Why do IPPrefixFrom and IPRangeFrom permit constructing invalid values? #178
Closed
Description
IPPrefix and IPRange have a Valid
method. This was very necessary when the types were transparent, since you could put whatever you wanted in them.
Now that the types are opaque, should their constructors return errors? Then we can guarantee that a particular IPPrefix/IPRange is always valid or zero, rather than have to deal with the possibility of invalid inputs into other functions.
If yes, should we also add Must* helpers that panic on error?
I'm intrigued by the idea of making invalid values unrepresentable, but also worried that it makes the API unwieldy to manipulate. thoughts?
Metadata
Metadata
Assignees
Labels
No labels