Why does EK9 require named arguments for 4+ parameters?
← Code Quality · Ref: Q817
EK9 requires named arguments when a call passes 4 or more positional arguments. Beyond 3 arguments, the 3rd and 4th are routinely confused.
THE RULE
3 or fewer positional arguments are fine:
connect(host, port, timeout) // OK: 3 args
4 or more trigger E11062:
connect(host, port, timeout, retries) // ERROR: use named
THE FIX
Use named arguments (EK9 requires all-or-nothing naming):
connect(host: host, port: port, timeout: timeout, retries: retries)
WHY THIS MATTERS
Miller's Law: humans can track 7 +/- 2 items. At 4+ parameters, positional confusion causes bugs that are invisible at the call site. Named arguments make every parameter's purpose visible.
See Q694 for named argument patterns. See Q816 for Boolean argument naming.
Example
defines module qa.quality.many.args defines function scheduleJob() -> jobName as String path as String retries as Integer interval as Integer stdout <- Stdout() stdout.println(`Scheduled ${jobName} at ${path} retries=${retries} interval=${interval}`) defines program ManyArgsDemo() stdout <- Stdout() // === CORRECT: named arguments for 4+ parameters === scheduleJob(jobName: "backup", path: "/data", retries: 3, interval: 60) // === CORRECT: 3 or fewer positional is fine === stdout.println("Three args or fewer: no naming required")
Common mistakes
E11062 — 4 positional arguments exceed the readability threshold. Use named arguments so each parameter's purpose is clear at the call site. See ek9 -h E11062 for details.
Incorrect:
scheduleJob("backup", "/data", 3, 60)
Correct:
scheduleJob(jobName: "backup", path: "/data", retries: 3, interval: 60)
Other ways to ask this
- What is E11062 MANY_ARGUMENTS_REQUIRE_NAMES?
- Why can't I pass 4 positional arguments in EK9?
- How do I fix many arguments need names in EK9?
Coming from another language?
Java: no enforcement. Python: PEP 8 recommends keyword args for clarity. Swift: requires argument labels by default. Kotlin: supports named args. EK9: 4+ positional args = compile error.
Keywords: E11062, arguments, positional, readability, quality, many, parameters, named