4 ms·
I thought you meant an extra required parameter. Adding an optional one should not be a breaking change, and I have an idea or two of how to do it without brea
by gavinhoward 3y ago
I thought you meant an extra required parameter.
Adding an optional one should not be a breaking change, and I have an idea or two of how to do it without breaking callers, even in a static language.
Adding a field to a struct should still be a breaking change because that field could be used. If the caller does not initialize it, you might have a bug.
If you're taking about Clojure maps, and not structs, that's completely different. But Clojure maps are open. Structs are closed.
Adding something to a closed thing is a breaking change. Why? Because of what I said above: the new thing needs to exist. Rich Hickey calls this "place-oriented programming," and he hates it for that reason. He's not entirely wrong either because yes, it can easily cause breaking changes.
But when you add something to an open thing like Clojure maps, that should not be a breaking change, and having implemented something like Clojure maps in C, I can tell you that it is not breaking, even in C.