3 ms·
I didn't watch it either, but... Does your language have exceptions? Do the exceptions support stack traces? Do those stack traces have line numbers? Well th
by marvy 6y ago
I didn't watch it either, but...
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.
- erik_seaberg 6y agoI was pretty impressed with Microsoft's support system that would pull up the symbols from the release build that created a crash dump. It's not a good use of time to troubleshoot using some wrong version of the code that may or may not even have the same problem.
- SahAssar 6y agoThat's only if you consider line numbers as part of the public API, which would be crazy.
- marvy 6y agoI'm guessing no one is crazy enough to consider line numbers part of the public API. And yet... I could imagine myself writing code like this if I were desperate enough, even though I would know perfectly well that my code would probably break the never next time I upgrade.