问题
What exactly is the purpose of the external
keyword in Kotlin?
I guess it's for JNI like native
in Java, but I can't seem to find any actual reference or documentation on this.
回答1:
Indeed, it's an equivalent of Java's native
. It's currently missing from the documentation but there's an issue to add it.
回答2:
According to documentation: external marks a declaration as implemented not in Kotlin (accessible through JNI or in JavaScript)
来源:https://stackoverflow.com/questions/35552834/what-is-the-purpose-of-external-keyword-in-kotlin