4 ms·
There's a sharp distinction between validation and typing. I can cast a string into a domain-specific Email type without validating the string. I can also rejec
by tel 4y ago
There's a sharp distinction between validation and typing. I can cast a string into a domain-specific Email type without validating the string. I can also reject a string due to a validation rule without changing its type.
Opaque type aliases are great because they impose semantics. Even if I don't know how to validate an email, it's nice, at times, to distinguish a string which I suspect to be an email from all other sorts of strings.
- persimmonster 4y ago