Rob
07/28/2021, 2:34 AMFudge
07/28/2021, 5:46 AMsuspend
can be thought of as context(CoroutineContext)
currentComposer
is also not dynamically scoped because @Composable
can be thought of as context(Composer)
typealias AndroidContext = @Composable context(Context,View,...)
// Then setContent is defined like this:
fun setContent(content: context(AndroidContext) () -> Unit)
// And libraries can add more stuff to the context...
typealias MaterialContext = context(AndroidContext, MaterialTheme)
context(AndroidContext)
fun MaterialTheme(body: context(MaterialContext) () -> Unit)
// And users can add more stuff to the context...
typealias MyContext = context(MaterialContext,MyDatabase)
context(MaterialContext) fun MyComponent(stuff: context(MyContext) () -> Unit){}
Rob
07/28/2021, 3:24 PMChuck Jazdzewski [G]
07/28/2021, 5:01 PM