E1014: named and positional arguments mixed

View source

A call passes its arguments either all by name or all by position.

A call passes its arguments either all by name or all by position. Mixing the two forms makes it unclear which parameter an argument fills, so the compiler rejects the call. Named arguments are the preferred form because they show the ownership role at each call site. The error points at the call.

Example

actus
verb scale(abs value: Int, abs factor: Int) -> Int {
    return value * factor;
}

verb main() {
    erg a: Int = 2;
    println(int: scale(a, factor: abs a));
}

Fix

Name every argument.

actus
verb scale(abs value: Int, abs factor: Int) -> Int {
    return value * factor;
}

verb main() {
    erg a: Int = 2;
    println(int: scale(value: abs a, factor: abs a));
}

Run actus explain E1014 in your terminal to read this entry offline. Browse Ownership & types or all error codes.