stefanus ayudha
07/10/2024, 12:23 PMross_a
07/10/2024, 12:30 PMrocketraman
07/10/2024, 12:40 PMrocketraman
07/10/2024, 12:48 PMstefanus ayudha
07/10/2024, 1:30 PMstefanus ayudha
07/10/2024, 1:33 PMross_a
07/10/2024, 1:35 PMrocketraman
07/10/2024, 1:46 PMstefanus ayudha
07/10/2024, 2:31 PMthis@ContextName.someFunction()
right? but the case with compiler might be real.
the context parameter give the context a named parameter so we need to call the name to call the function, isn't it so?
in that case, context receiver should be fine to upgrade to context parameter latter right? as long as we don't have duplicated or similar jvm signature for the function in the context. in this case, put some limitation to the implementation should be fine.
or is there another concern?stefanus ayudha
07/10/2024, 2:40 PM@Immutable
interface SystemLoggerScope {
fun log(message: String)
}
@Immutable
class SystemLoggerScopeImpl : SystemLoggerScope {
override fun log(message: String) {
println("Singularity Log: $message")
}
}
@Immutable
interface ImpostorScope {
fun log(message: String)
}
@Immutable
class ImpostorScopeImpl : ImpostorScope {
override fun log(message: String) {
println("Imposter Scope $message")
}
}
@Immutable
data class MyBussinessScope(
val unit: Unit = Unit,
) : SystemLoggerScope by SystemLoggerScopeImpl(),
ImpostorScope by ImpostorScopeImpl() {
override fun log(message: String) {
println("MyBussinessScope $message")
}
@Composable
fun SingularityScopeCompose(
content: @Composable MyBussinessScope.() -> Unit,
) {
content()
}
}
I implement both SystemLoggerScope and ImpostorScope
and the compiler force me to override the method with same signature name.
and there is no compilation error. the app working fine. without needed to refactor.
Sorry about this question goes on in multiplatform channel..