4 ms·
Yes, type-driven development saves so much hassle, both in ingesting user-provided data (parsing request bodies etc) as well as limiting the API surface of what
by kroltan 4y ago
Yes, type-driven development saves so much hassle, both in ingesting user-provided data (parsing request bodies etc) as well as limiting the API surface of what you can do to things.
Sadly, one very useful feature is missing from most languages, and that is, the ability to make opaque or partially transparent wrapper types. For example in C# before record types, you'd need about 30 lines of boilerplate if you wanted to make a wrapper for an identifier that can only be compared for equality.
Wrapper and rich types allow writing shared behaviours for those specific kinds of information, and greatly reduce the "accidental API surface" of primitive types that plagues us with so many bugs and data leaks.