When project gets build and reaching this task ```...
# compose-ios
f
When project gets build and reaching this task
Copy code
> Task :shared:compileKotlinIosX64
I get this warning
Copy code
warning: Named arguments in composable function types are deprecated. This will become an error in Kotlin 2.0
Why would this be the case? (edited)
🙌 1
a
Oh wow. Why would this be deprecated? Having named arguments makes the code so much more readable.
j
They're not supported in K2 for compiler plugins to see
a
That’s inconvenient
p
Kinda inconvenient right. Unless IJ/AS provide some hints for the parameters as they do in java.
j
Java lambdas are nominal types with a unique method and signature. Parameter names are still opt-in for javac.
Kotlin lambas are structural, or rather are nominal based on structure therefore you don't get to pick the function name, signature (it's structural and uses generics), and definitely not parameter names.
p
Ahh 😫 ok, well, we gotta get used to the fact.
v
I am sorry, do I understand correctly that I will have 7 build errors in here since Kotlin 2.0?
Copy code
Text(
    // Doing it this way is deprecated and won't build since Kotlin 2.0?
    modifier = Modifier,
    text = text,
    fontSize = textFontSize,
    fontWeight = textFontWeight,
    color = textColor,
    maxLines = 1,
    overflow = TextOverflow.Ellipsis
)
j
No. That's a normal function.
They are being removed from function types (i.e., lambdas)
v
Confusing.
Copy code
Scaffold { paddingValues: PaddingValues ->

    }
So the the
paddingValues: PaddingValues ->
will be removed? We will have to use only
it
?
j
No that's implementing a lambda. This is about invoking one with named arguments.
v
Then this?
Copy code
@Composable
fun test() {
    someComposable.invoke("param value")
}

val someComposable: @Composable (someParam1: String) -> Unit = { myImplementationNameOfParam1: String ->
    // empty
}
But I can't add named parameters for the
someComposable.invoke()
even with Kotlin 1.8.21
j
Sorry I don't recall the history with K1. Vaguely feels like it used to be allowed and was removed there as well.
🙌 1
v
Thank you. For a moment I was worried that named variables for normal composable functions will be removed and 99% of my current code will stop compiling
j
I think that would break everyone!
a
Ooooh. I was also confused.
p
Same here 🙌🏻