Should native be a modifier?


I'm seeing this as I upgrade to M13...

  Warning:(71, 1) Kotlin: Annotations without ‘@’ are deprecated now

  native fun foo(a: String): Unit = noImpl

I that on purpose? I thought native would be a modifier, since it is in Java.



There's a discussion of this in another thread here:

I’d put it like this - modifier vs annotation is going to seem pretty random in Kotlin because the criteria used are rather subjective, e.g. modifiers are “heavy” and annotations are “light”, and there’s a distinction between the language and the platform that is to my mind a little blurry.

In this case, native is an annotation presumably because it’s a part of the platform, i.e. it does not have an equivalent in Javascript.


Okay, thanks.

(The “native” annotation/modifier does exist in Javascript - but it’s not implemented the same way of course.)



"native" is a JS-specific thing in Kotlin. A modifier with a somewhat related meaning is "external", it means "a non-abstract functinon with no body". It may be used as an alternative to "= noImpl"


In Js we also have native classes and properties, so will be nice to allow this modifier for them too (in JS)


We'll need to discuss this further. Properties are easy, classes — not so clear