What does the header / impl keyword mean in kotlin?

A few moments ago, when I was studying Kotlin github relay, I found something interesting: now Kotlin now has 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 this some kind of public function or an internal function to help develop stdlib?


EDIT: There seems to be an impl keyword that works along with the header. What is it?

+6
source share
1 answer

UPDATE 2:

Support for multi-platform project released.

UPDATE 1:

The keywords impl and header were replaced by actual and expect in the preliminary release of multi-platform projects for Kotlin.

The official documentation can be found here or at the same time GitHub permalink


This was discussed in this video at 14:28.

From slides : Slide # 14

In principle, header will be used when writing interfaces for modules operating on several platforms (JVM, JS and Native). The impl will be used when writing an implementation for a particular platform.

+5
source

Source: https://habr.com/ru/post/1015624/


All Articles