3 ms·
I've always been disappointed by how few strongly typed languages have copied Ada's range subtype system. It was one of the things that made the language so ni
by noneeeed 2y ago
I've always been disappointed by how few strongly typed languages have copied Ada's range subtype system. It was one of the things that made the language so nice to work in, and helped make a number of approaches to formal methods much more tractable.
Being able to write a function/procedure and know that the parameters could only be within a certain set of legal values by that point let you avoid a lot of defensive coding, without having to rely on developers remembering to check their values.
If you got your values into domain specific subtypes as early as possible your code was so much easier to reason about. It made a lot of the static analysis easier as well.