Date: Fri, 2 Jan 2026 20:49:02 +0100
> What about a mixture of positional and named parameters?
>
I have some thoughts on that here:
https://eisenwave.github.io/cpp-proposals/named-args.html#mixing-named-and-positional-arguments
Things can get pretty confusing when mixing of positional and named
arguments is permitted. The low-hanging fruit is to allow positional
arguments at the start of the argument list, which has the obvious behavior
of working exactly like positional arguments normally do.
More recent versions of Kotlin allow you to mix positional and named
arguments in the middle, but only within a prefix of arguments where if an
argument is named, it needs to be in the same position as if it was
provided positionally. For example, f(.first=0, 1) is valid, but f(.second=1,
0) is not. However, what Kotlin eventually made valid is unnecessarily
ambitious for the first version of such a feature.
>
I have some thoughts on that here:
https://eisenwave.github.io/cpp-proposals/named-args.html#mixing-named-and-positional-arguments
Things can get pretty confusing when mixing of positional and named
arguments is permitted. The low-hanging fruit is to allow positional
arguments at the start of the argument list, which has the obvious behavior
of working exactly like positional arguments normally do.
More recent versions of Kotlin allow you to mix positional and named
arguments in the middle, but only within a prefix of arguments where if an
argument is named, it needs to be in the same position as if it was
provided positionally. For example, f(.first=0, 1) is valid, but f(.second=1,
0) is not. However, what Kotlin eventually made valid is unnecessarily
ambitious for the first version of such a feature.
Received on 2026-01-02 19:49:16
