4 ms·
Although I don't think it applies in this example, it might be worth pointing out a trade-off: the more constraints you encode into parameter or return types in
by skybrian 7y ago
Although I don't think it applies in this example, it might be worth pointing out a trade-off: the more constraints you encode into parameter or return types in a API, the more specialized it is and the more likely that a change will be backward incompatible.
- firethief 7y agoLet's consider two types of constraints: incidental constraints, and necessary constraints that would also exist when latently-typed. Having much of the former is a design smell. The latter force you to address problems at compile time that might otherwise be hidden crashes, security flaws, logic bugs... I think the trade-off is that designing with types is hard, and without a lot of experience in a statically-typed language types can create more problems than they solve, as in the original code this blog post corrects.