Repository navigation
Description
Summary
The original "implement named arguments" premise is stale: parser, sema, and behavior coverage now exist for core named calls. The remaining work is to remove stale blocked notes, add spec-shaped coverage, and leave the rule-gap issues (#456 and #508) as the active follow-ups.
Spec
§9.1a allows parameters to be passed positionally or by name, with positional arguments before named arguments, exact parameter-name matching, arbitrary order among named arguments, defaults filled at the call site, and call resolution order of positional, named, implicit, then defaults (docs/with-specification.md:3063-3102). It also excludes named arguments for extern fn values, closure values, and placeholder-based partial application calls (docs/with-specification.md:3097-3100).
Current state
Parser.parse_call recognizes name: value, tracks positional-after-named as a parse error, stores per-argument names in AstPool.call_named_args, and wraps placeholder calls after preserving that metadata (src/Parser.w:4009-4102, src/Ast.w:1170-1180). Sema.check_call rejects named args on closures/function pointers (src/SemaCheck.w:7835-7839) and reorders named arguments, checks unknown/duplicate names, fills implicit parameters, then fills defaults (src/SemaCheck.w:7855-7929). test/behavior/behav_named_args.w:15-44 already covers ordered, reordered, mixed, and defaulted named calls.
The stale part is documentation/test inventory: test/spec/spec_ss09_1a_named_arguments_and_implicit_context.w:1-21 still says named arguments and implicit context are not implemented and leaves the spec examples commented. Separate real gaps remain in #456 (implicit+default and placeholder+named rejection) and #508 (missing negative and evaluation-order coverage).
Implementation plan
- Treat this issue as verify-and-close, not a new implementation project.
- Update the stale spec test in the eventual implementation PR: uncomment the named-argument examples in
test/spec/spec_ss09_1a_named_arguments_and_implicit_context.w, add the implicit-context form, and keep expected stdout/check-only directives aligned with current harness style. - Ensure the call-resolution tests cover the exact §9.1a order: positional, named, implicit, defaults. Named and implicit behavior should not rely solely on
test/behavior/behav_named_args.w. - Leave semantic rule gaps to Named-args rule gaps: implicit+default rejection, placeholder+named rejection (§9.1a, §9.4) #456 and test-only coverage to Tests: named args coverage (§9) #508 so this issue can close once the existing implementation is verified against spec examples.
Test plan
Promote test/spec/spec_ss09_1a_named_arguments_and_implicit_context.w from a default-only test into a full §9.1a spec test:
label("db", port: 5432)uses defaulttimeout.label(port: 5432, host: "db", timeout: 5)proves named reordering.- an implicit parameter filled by
with context(ctx):is overridden by an explicit named argument.
Run existing test/behavior/behav_named_args.w to guard the current behavior test.
Acceptance criteria
- The stale "named arguments not yet implemented" comments are gone from the spec test.
- Spec examples for named calls and implicit override pass.
- Named-args rule gaps: implicit+default rejection, placeholder+named rejection (§9.1a, §9.4) #456 remains the tracking issue for rule gaps and Tests: named args coverage (§9) #508 remains the broader coverage issue.
with build && with build :fixpoint && with build :testpass.
Activity
ehartford commentedon Jun 10, 2026
Scope correction from the requirements campaign (2026-06-10): named arguments are IMPLEMENTED — verified empirically (reordering, mixing, defaults-by-name) with
behav_named_args.w+ negative tests; the 'blocked' comments inspec_ss09_1a_*.ware stale. Remaining before close: the rule gaps tracked in #455 (implicit+default rejection, placeholder+named rejection) and test additions in #500. This issue can likely close after verifying the §9.1a resolution-order conformance.ehartford commentedon Jun 10, 2026
Correction to the previous comment: the rule-gap issue is #456 and the test issue is #508 (not #455/#500).
ehartford commentedon Jun 14, 2026
Implemented in the latest main commit. The stale §9.1a spec test now executes named arguments, default parameters, implicit parameter resolution, and explicit named override of an implicit parameter. Existing behavior coverage was also verified. Rule gaps remain tracked by #456/#508 as intended. Verification passed: build, fixpoint, full :test, and explicit :test-green.