2 ms·
It doesn't fix everything, but judicious use of private data constructors and custom types can go a long way towards reducing the need for asserts. They can bub
by dwohnitmok 8y ago
It doesn't fix everything, but judicious use of private data constructors and custom types can go a long way towards reducing the need for asserts. They can bubble up potential violations of preconditions and force handler code to be written.
Some Scala examples, but they're hopefully quite language agnostic:
https://m.youtube.com/watch?v=Csj3lzsr0_I https://m.youtube.com/watch?v=Csj3lzsr0_I
https://m.youtube.com/watch?v=keTId618iOs https://m.youtube.com/watch?v=keTId618iOs