Post #1864450
2026-04-21 20:16 UTC
He asked, ‘What would I do differently?’ and I said I would write strictly structured code. To this I added no details except I explained the reason was so one could count cyclometric complexity by eyeball. (The method is you count conditions in branches and loops, then add one.)
This smart alec then said something about early exits not bringing the complexity lower and me being a ideologue. I emphasized I had said nothing about bringing the complexity lower, but about being able to count it.
Replies (1)
-
@chemoelectric@masto.ai 2026-04-21 20:20
I added also that having all the exits go through the end of the subroutine meant that, if you turn off the optimizer, then the debugger is much easier to use. This is no small matter. Early exits mean the subroutine may exit at any of several points. And the smart alec pointed out that I would have had to turn the Rust code’s immutable value into a mutable variable, to which my reaction was, ‘So?’ And, anyway, a really, really safe language would have LINEAR vars that made this no problem.