4 ms·
When you have a non-emptiness property on a type, the compiler can guarantee you that all current and future occurences of values of that type in the system wil
by ghostwriter 6y ago
When you have a non-emptiness property on a type, the compiler can guarantee you that all current and future occurences of values of that type in the system will be interacted consistently with the specified non-empty property. Or in other words, the accent is moved from the limited set of units that you are able (and willing) to test to the invariants that will be held for all occurences of the type at all times, regardless of an unlimited number of units that are willing to use them.
- crazydoggers 6y agoHow does one guarantee that for all values? If we’re talking about a parser, wouldn’t it need to test all the values? And if your not testing all the values, aside from simple cases, it’s not something that could just be computed (np, halting problem etc)... so wouldn’t the parser still just need to test some preset number of values? I guess maybe we’re talking kind of like a prebaked in set of unit tests for certain circumstances?