3 ms·
> 10 types of string It's not. It's 10 types.
by michaelcampbell 7y ago
> 10 types of string
It's not. It's 10 types.
- bewo001 7y agoI want to agree, but the problem is that you now need 10 versions for many operations that are in a string library. Hidden assumptions -- like 'replacing a character in a string can never fail' -- may fail (eg in an email address type which only allows only a limited char set). Some constraints can't be expressed without dependent types (say you want to define a URI type that limits the length to 2000 chars total but is composed of variable length components, like the domain name, query strings etc).
- michaelcampbell 7y ago> but the problem is that you now need 10 versions for many operations that are in a string library Do you? Or do you need just the operations for the things that are relevant to the type at hand? Limiting a broad API to the needed interface for the type you're modeling is a GOOD thing.