zsqw123
09/23/2023, 5:42 PMclass Foo {
api fun bar(): String
}
// write in another file
impl fun Foo.bar() = "bar"
The reason I want to implement this is that I want the actual implementation of the bar
function to be implemented by KSP generated code, and I want it to be a member function that does not require import and does not need to wait for KspDebug
to finish executing before calling tohfhbd
09/23/2023, 5:47 PMzsqw123
09/23/2023, 6:07 PMfinal
rather than open/abstract.😂 and I don't really want it to have subclasses. Using KCP also requires synchronous development of IDE plugins to avoid IDE errors for not implemented, and many languages actually have similar api and implementations separate logic(like header)
And, api separation is actually a way to explicitly declare api. it is also a easy way to optimizing compiler's tracking of abi changes for incremental compile.
It also provide a simple way to compare the api changes between old and new versions.
Also, if adding a new keyword doesn't good, can we consider existing external
keyword? Not just for interacting with native, but also for this additional api/impl seperation?ephemient
09/23/2023, 8:46 PMclass Foo {
fun bar(): String = barImpl()
}
internal fun Foo.barImpl() = "bar"
asdf asdf
09/24/2023, 12:07 AMexpect/actual
, although might be sort of weird to use it on just a single platformzsqw123
09/24/2023, 2:14 AMexpect/actual
, but I want to use it in single sourceset(platform), and maybe when no actual
impl, it will not show the ide errorDerek Peirce
09/28/2023, 7:56 PM