Named Kotlin function types
Kotlin does not support SAM conversions of types defined in Kotlin, because the preferred way is to use function types instead. But SAM has some advantages over classic function types: named function types and named parameters. It is good to have the function type named when its definition is long or it is passed multiple times as an argument. It is also good to have named parameters when it is not clear what each parameter means just by its type.
In the upcoming sections, we are going to see that it is possible to name both the parameters and the whole definition of a function type. This can be done with type aliases and named parameters in the function type. This way, it is possible to have all the advantages of SAM while sticking with function types.
Named parameters in function types
Until now, we've only seen definitions of function types where only the types were specified, but not parameter names. Parameter names have been specified in function literals:
...