I’m surprised that it works. I’d like to have that...
# javascript
m
I’m surprised that it works. I’d like to have that as a feature 😄
Copy code
external interface Foo
external interface Scope {
    @Suppress("INLINE_EXTERNAL_DECLARATION", "NON_ABSTRACT_MEMBER_OF_EXTERNAL_INTERFACE", "WRONG_MODIFIER_CONTAINING_DECLARATION", "WRONG_EXTERNAL_DECLARATION", "WRONG_BODY_OF_EXTERNAL_DECLARATION")
    final inline fun Foo.print() {
        console.log("${this@Scope}.$this")
    }
}

fun main() {
    val scope = "scope".unsafeCast<Scope>()
    val foo = "foo".unsafeCast<Foo>()
    with(scope) { foo.print() }
}
t
There is no big difference between
external
and
ordinal
types for compiler. Current limitations for
external
are unnatural. In IR even inline methods/properties work for
external
🙂
m
final inline
also isn’t allowed in non-external interfaces.
t
Limitation from JVM 🙂
m
Not really. The JVM doesn’t know nor need to know about
inline
functions.
t
Hmm… Your truth