I've a question to inline fuctions: Up to now they serve two fuctions, first a performance optimisation and second to enable refied generics. I've i'm not mistaken, the JVM Jit is really good in inlining and together with escape analysis and on stack allocation it should be able to do the same performance optimisation as the kotlin compiler does (or do I miss something). So the really intresting point is the refied generic part. So my question is are their further features planned which will be only avaiable for inline functions? I could think of structural types for example, which would be realy easy to implement for inline functions and hard otherwise (reflection or invokeDynamic or additional parameters etc..). This could open the door for a type clases pattern:
inline fun <T{object Companion{ val showable:Showable<T> } > myFun(xs:T, Showable<T> fl = T.showable){
… do stuff …
}
//T needs to have a Companion object with a showable property
to add the instance:
val List.Companion.showable:Showable<T>
get() = …
and callable as:
myFun(instanceOfList)
even if we could only restrict the instance member this would be a mighty tool together with extension funstions especially for creating DSL’s
And i think their is more stuff which can be enabled by inline functions.