194. Integer domain positions and plain enums are read and written in O(1) (2026-11-22)
- Decision. For a fn's estimated cost, a position in a domain written
as an integer range (
domain Pos = 1..=n), a product of such domains, or a variant of an enum with no fields is read and printed inO(1), like a number. A fn whose value isread()orask(..)reads its declared return type, the same aslet x: T = read(). This narrows 29.49, which left out every domain position since a label may be a string; an integer range's labels are integers. - Why. Interactive ports write
fn ask(lo: Pos, hi: Pos) -> Int:withprint("?", lo, hi)thenread(), and none of them got an estimate. Fns incorpus/problemsand the examples with an estimate: 25 to 26 of 1,613;printblocks 14 fns instead of 18,readandasknone. - Reverse. Make
io_fixedincpl-checkreturnty.is_fixed_size()and dropfixed_read.