Design decisions

59. Heterogeneous operator traits (Add/Sub/Mul/Div/Rem with Rhs and Out) (2026-11-21)

  1. Operator traits accept an optional Rhs type argument (defaulting to Self) and an optional type Out = T associated type (defaulting to the method's return type or Self). For example, impl Mul<F64> for Vec: fn mul(a, k) = Vec(a.x * k, a.y * k) and impl Mul<Vec> for Mat2: type Out = Vec; fn mul(lhs, rhs) -> Out = ... coexist on the same struct alongside homogeneous impl Mul for Mat2 without colliding in cpl-check (keyed by trait_impl_key) or cpl-ir (dispatched by (method, rhs_ty) in StructInfo.op_methods). Reason: eliminates .scale(k) / .div(k) workarounds in std.geometry (research/frictions/cf2138f.md), std.mod, and std.matrix with one general mechanism available to all user and stdlib structs, while keeping every existing impl Add/Sub/Mul/Div for T unchanged. Reverse: revert trait_impl_key/Def::Impl.trait_args/out_ty in cpl-check and StructInfo.op_methods/struct_op_fn_for in cpl-ir.