Just moments ago when I was exploring the Kotlin github repo, I found something interesting: Kotlin now seems to have a header keyword.
CollectionsH.kt:
open header class ArrayList<E> : MutableList<E> {
//...
header inline fun <reified T> Array<out T>?.orEmpty(): Array<out T>
What does it mean? Is it some public available feature or a internal feature to help stdlib development?
EDIT: There seems to be a impl
keyword that work in conjunction with header. What's that?
Multiplatform project support has been released.
The impl
and header
keywords have been replaced by actual
and expect
in the preview release of multiplatform projects for Kotlin.
The official documentation can be found here or at this GitHub permalink
It was talked about in this video at 14:28.
From the slides:
Basically, header
will be used when writing interfaces for modules that work across multiple platforms (JVM, JS, and Native). Theimpl
keyword will be used when writing an implementation for a specific platform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With