169. Named-argument and record-field punning f(x:) (2026-11-21)
- Decision. A named call argument or parenthesized record field whose value is a variable of the same name may be written in punned shorthand:
f(moves:, cost:, step:)meansf(moves: moves, cost: cost, step: step), and(moves:, cost:)means(moves: moves, cost: cost). - Mechanism. Parser-only desugaring in
Parser::argandExprKind::Record(crates/cpl-syntax/src/parser/expr.rs): when aname:label is immediately followed by,or), the parser buildsExprKind::Name(name)atname.span. No checker, IR, interpreter, or C++ codegen special case is needed; LSP hover resolves the local's type through the synthesized expression span.cpl-fmtpreserves tokens strictly and formats punned calls/records without spaces before:or,. LintL0209(redundant_arg_name) warns onname: namewith a machine-applicablecpl fixtoname:. - Evidence. Corpus audit found 155 exact
name: namesites across 54 port files and 75 across 10 stdlib files (52 reviewed port files and all 10 stdlib files migrated viaL0209; 2 unreviewed ports left untouched for review-check). Interp/C++17 parity testcrates/cpl-cli/tests/programs/named_arg_punning.cp(345 12 7), formatter testformats_punned_named_args_and_records, LSP testhover_on_punned_named_arg_shows_local_type, lint testredundant_arg_name_shortens_to_punning, and docs insite/content/types-and-control.md. - Reverse. Remove the punning branch in
Parser::argandExprKind::Record, removeL0209, and expandname:back toname: name.