OxL Reference

error named-arg

error Standard: [§6.1]

What it means#

In a call, positional arguments come first and then named arguments (greet("Ann", loud: true)); a positional argument after a named one is forbidden (§6.1). A named argument must also name an existing parameter and may not be given twice.

Example#

oxl✓ checked in CI
fn greet(name: str, loud: bool = false, tail: str = "") -> str => name

fn main() {
  greet("Ann", loud: true, "!")      // <- named-arg (positional after named)
}
error
named-arg

How to fix#

oxl✓ checked in CI
fn greet(name: str, loud: bool = false, tail: str = "") -> str => name

fn main() {
  greet("Ann", loud: true, tail: "!")
}

Name the trailing arguments too, or reorder them so that all positional ones come first.

See also#

OxL 1.0.0-beta · Documentation version 1.0.0-beta© OxwaldLink · generated from the Standard, the std sources and the guides