4 ms·
In practice if your 'id() string' method returns an id as a string for the object doesn't it do what you need it to? So you actually need to care whether the in
by zaphar 7y ago
In practice if your 'id() string' method returns an id as a string for the object doesn't it do what you need it to? So you actually need to care whether the intended to satisfy your contract or not?
You might care if you expect the Id string to look a particular way. But then you probably wanted to use a type other than string for the return type.
- mrkeen 7y ago> you probably wanted to use a type other than string for the return type. That's the point. In order for (String userId) to not be confused with (String password), I wrap them with nominal types UserId and Password. If the language looks at both UserId and Password and decides they're interchangeable because they both satisfy the contract 'contain a String', then that completely negates the point.