arkivanov / MVIKotlin

Extendable MVI framework for Kotlin Multiplatform with powerful debugging tools (logging and time travel)
https://arkivanov.github.io/MVIKotlin
Apache License 2.0
847 stars 32 forks source link

Consider executeIntent and executeAction in DSL #33

Closed arkivanov closed 2 years ago

arkivanov commented 2 years ago

After some digging and experimenting, there some downsides:

  1. The ability to execute Intents and Actions from DSL handlers would make the API more complex. E.g. CoroutineExecutorScope and ReaktiveExecutorScope would receive two additional type parameters - Intent and Action.
  2. Currently the data flow in DSL-based code is kinda uni-directional. E.g. handlers have Intent and Action as inputs, and Message and Label as output. The ability to execute Intents and Actions from DSL handlers would add some mess - Intents and Actions are inputs and outputs at the same time. This doesn't look clean.

It's advised to extract common methods, as demonstrated in the sample.