> (including changing comments).
Huh? I didn't watch, but practically speaking, how do you break something by editing comments? Let's assume it's an actual comment and not a shebang line or something.
Huh? I didn't watch, but practically speaking, how do you break something by editing comments? Let's assume it's an actual comment and not a shebang line or something.
Does your language have exceptions? Do the exceptions support stack traces? Do those stack traces have line numbers? Well then...
// old code: version 1.2.3
if(problem1) throw new Exception();
if(problem2) throw new Exception();
Meanwhile, we have client code that catches the exception and then inspects the line number to see whether it was caused by problem1 or by problem2.(You may say that this is crazy and no one would do such a thing. Maybe so. But this at least proves that it's theoretically possible. Also, you'd be surprised at what some people will do.)
Anyway, we upgrade to the new code:
// new code: version 1.2.4
// Helpful comment here; no other changes.
if(problem1) throw new Exception();
if(problem2) throw new Exception();
And of course this comment messes up all the line numbers, at which point we can have anything from misleading error messages to system meltdown, depending on what the client code used the line number for.More on Hyrum’s Law: https://www.hyrumslaw.com/
SemVer is a claim about the public API, not the total of behavior you could potentially observe and react to.