Design decisions

129. Compound assignment is a statement; min= / max= report improvement (2026-11-21)

  • Decision. x op= y (+=, -=, x f= y for any two-argument fn) is a statement with no value, like plain =. The exception is min= and max=: as an expression they are a Bool, true when x strictly improved (including from none), so relaxation reads if dist[v] min= nd: parent[v] = u. Used as a statement the Bool is discarded. Bump-and-read uses a named mutable alias, which evaluates the place once: let k = mut count[c]; k += 1.
  • Why. No if x = y bugs and no evaluation-order puzzles; the one value contestants constantly test after an update ("did it improve?") has a direct spelling with one comparison, as in hand-written C++.
  • Rejected for now. Every op= yielding the new value (let k = count[c] += 1): convenient, but it puts writes inside expressions; revisit with port evidence.
  • Reverse. Make min= / max= plain statements, or give every op= the new value.
  • Status. Accepted (Ryan, 2026-11-21); not implemented.