Backwards compatibility (for behavior) is tough to get right

How does a bug fix differ from any other change in behavior? Why are bug fixes backwards compatible, but other changes are not?

Bug fixes are backwards compatible because the actual behavior differs from the expected behavior. Some bugs are obviously bugs (e.g. crashes, data loss) while others are not obvious (e.g. relative path when it should have been an absolute path).

A bug could be subtly incorrect behavior that someone relies on. (e.g. expecting a relative path, and switching on first path component of that relative path). If that bug is fixed, then the behavior changes, which might create a bug for someone else.

The underlying issue is that the expected behavior is not clear.

Statically typed languages could help with this problem, as it helps formally define what the expectations are.

Note last edited November 2023.