TBF adding parameters is a breaking change in most languages unless they have defaults, or even then.
In javascript it's a corrupting change, it may silently break all callers.
No I don't? A breaking change means working code doesn't work anymore. In a statically typed language, if a dependency adds a parameter to a function your code stops compiling. That's very much a breaking change.
Original function:
doSomething(foo){
*body*
}
Refactored functions: doNewSomething(foo, bar){
*body*
}
//now a convenience function doSomething(foo){
bar = defaultValue;
doNewSomething(foo, bar);
}
Doesn’t this solve this when updating a library?Like if you only pass one variable, you get the old behavior, and to pass two variables you have to call a new function name.
What am I misunderstanding about what you are writing.
toReadableNumberWithBase(num, base)
[array mapSelector:@selector(toReadableNumber:withOptions:)
fromObject:[NSFormattingManager localizedFormattingManager]
withArguments:@[@{kCFNumberFormattingBaseKey:@(10)}]];
Thank god they invented @-syntax for core type literals.A better language might have a special syntax or specific types for mapping functions but that's not the argument you were making.
- Version should be bumped - Dependencies should be informed via the changelog - Existing tests of dependencies should fail
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.