Design decisions

192. read<T>() and a choice of fixed text cost O(1) (2026-11-22)

  • Decision. In a fn's estimated cost, read<T>() costs O(1) when T has a fixed size, the same as let x: T = read() (29.49). A value whose every branch is fixed text or a fixed-size value, such as if ok: "YES" else: "NO", has a fixed size, so printing it costs O(1).
  • Why. Both are common in the ports and were left out only because the check looked at a declared let type and at the inferred type Str. Fns in the ports and examples with an estimate: 40 of 2,183.
  • Reverse. Drop the ExprKind::Generic and ExprKind::If cases in cpl-check's fixed-size checks.