3 ms·
I don't understand this argument. Let's say you remove a typed param and replace it with a new one of the same type, how will your typed language protect you th
by dsego 6y ago
I don't understand this argument. Let's say you remove a typed param and replace it with a new one of the same type, how will your typed language protect you then? Is that a case that should be handled in a backwards compatible way? Changing a function signature is a breaking change. In some cases like function arity or different types your compiler could catch it and throw errors (and break your program, hence breaking change).
A better language might have a special syntax or specific types for mapping functions but that's not the argument you were making.
- reeeeee 6y agoIf you remove a typed param and replace it with a new one of the same type, typing will indeed not save you. But there should be other checks to warn you: - Version should be bumped - Dependencies should be informed via the changelog - Existing tests of dependencies should fail
- valenterry 6y ago> Changing a function signature is a breaking change Not if your language has default parameters and does not allow callers to pass "extra" parameters. Then you can easily add a new parameter with a default value and older callers will work as expected.
- globular-toast 6y agoI forgot to say I meant adding an optional new parameter to a function. Obviously adding a new parameter to a function is a breaking change for any API regardless of language.