gabrielfv
08/11/2020, 10:23 PMController<S>
and a View<S>
and I want this to work as a cyclic dependence where the controller depends on the view indirectly. For that I was thinking on defining a Provider
that takes a concrete controller and creates an instance of view with that injected.
Currently it looks like this:
fun interface ViewProvider<C : Controller<S>, S : State> {
fun get(controller: C): View<S>
}
It feels redundant that I have to locally specify S
, since Controller<S>
already does that job. For example:
class AController : Controller<A>
class Provider : ViewProvider<AController, A>
S
here can only be A
, since Controller<S>
is invariant in S
, and here S
is A
. Specifying A
looks somewhat redundant.
Could the type parameter here be inferred so the client code becomes less redundant?dmitriy.novozhilov
08/12/2020, 11:30 AM