3 ms·
I think nominal types are a must, otherwise you lose most of the benefits of static typing. Is an Email type the same as a String even though they are the same
by kaba0 6y ago
I think nominal types are a must, otherwise you lose most of the benefits of static typing.
Is an Email type the same as a String even though they are the same under the hood? I precisely should not accept it without explicitly casting it, otherwise I would have duck typing. But I agree that explicit structural types can be useful at places.
- valenterry 6y agoI think you misunderstood my idea. For example, check the User that I defined. Even if you would have another type with the same structure, the name would be different, so it would not be interchangeable without a "cast", even though both are ultimately structural types. It's just that the name is now part of the structural definition.