255. A range passed where a struct's type argument is a domain is an anonymous domain (2026-11-22)
- Decision.
Dsu<0..n>()means whatdomain V = 0..n; Dsu<V>()means: when a struct's type parameter is used as a domain (indexes a field or a method's array), a range written in its place is an unnamed domain over that range. The same range text in one module names one domain, sovar d: Dsu<0..n> = Dsu<0..n>()agrees with itself. A parameter used only as a value keeps the bounded integer type (Cell<0..=9>). - Why. Q2's recommended default (a). It extends decision 159: an inline
(V, V)is already an anonymous product domain, so an inline range is the same idea one level down. It keeps one-line examples one line (174 std doc examples writeDsu<0..3>,SegTree<0..4, Int>), and a name used once protects nothing. Arrays still cannot mix two anonymous domains by accident: each distinct range text is its own domain. - Reverse. Restore the E0204 check
range_as_type_argincrates/cpl-check/src/check/types.rs(and its call incheck/expr.rs), deletecrates/cpl-ir/src/lower/anon_domain.rsand its call inresolve_gen_args_for_struct, and migrate written uses with acpl fixrewrite todomain V = <range>.