carlos cdmp
09/18/2019, 3:08 PMdiesieben07
09/18/2019, 3:11 PM*
is equivalent to in Nothing
when writing values.
*
means you don't know what the type is, so you have no way of putting any value in, since there is no way to prove that it matches the actual type (since you don't know what the actual type is).streetsofboston
09/18/2019, 3:15 PMMutableList<*>
will be problematic when trying to call add
(and even call get
, since it’ll return an Any?
), but calling size
or toString()
is fine….carlos cdmp
09/18/2019, 3:15 PMval middleWareMap: Map<KClass<*>,Middleware<AppState, *any class extending action*, *any class extending action*>>
streetsofboston
09/18/2019, 3:17 PMMap<KClass<*>, Middleware<AppState, Action, Action>
?Evan R.
09/18/2019, 3:18 PMinterface Middleware<S: State, out A: Action, out A2: Action> ...
streetsofboston
09/18/2019, 3:22 PMA
should be contra-variant (in
) at best (and A2
can be co-variant (out
))carlos cdmp
09/18/2019, 3:22 PMstreetsofboston
09/18/2019, 3:23 PMin
nor out
) if you are not interested in the assignability of sub-types of Middleware
based its type-parameters A
and A2
to a plain Middleware
type.