""Named arguments are not allowed for function types"


I have quite a few functions that I fix some of the arguments like partial application before injecting the new function into some other function. I’d like to be able to call the resulting function using named arguments.

The following works

fun add(a: Int, b: Int): Int {
    return a + b;

fun createIncrementer(a: Int): (Int) -> Int {
    return fun (b: Int): Int {
        return add(a = a, b = b);

val plusOne = createIncrementer(a = 1);

Log.d("asdf", "add(a = 1, b = 2) returns " + add(a = 1, b = 2));
Log.d("asdf", "plusOne(2) returns " + plusOne(2));

But for better readability, I’d like to be able to write

Log.d("asdf", "plusOne(b = 2) returns " + plusOne(b = 2));

I see the following at https://jetbrains.github.io/kotlin-spec/#_misc

TODO: named arguments are not allowed for function types (both in () and .invoke() invocations)

Does this mean named arguments are coming or is this a note to document that they are not coming?



There is no short- or medium-term plan to add support for named arguments in function types. The TODO means that the restriction needs to be documented.


After another 6 months working with Kotlin, I still think that named arguments for functions would be a valuable addition and make the language more uniform.


Agreed they would be nice to have, but that does not mean it is a high priority. Named arguments for function types IMO would be nice but they are not necessary and it’s not a feature that would be used often even if it existed.
I think currently there are more important features to work on (serialization, coroutines, native, everything in KEEP, etc).