dniHze
05/22/2021, 4:58 PMFlow.flatMap
operator? I know that direct replacement for it is Flow.flatMapMerge
, but I'm still wandering why the team decided to avoid regular flatMap
naming for particular operator in a favor of, well, a longer and more self-describing name.
For me it's kinda weird trying to name basically the same thing differently, especially from the common to other libraries and languages perspective. Not trying to convince anybody to rename the operator, just searching for the reasoning.diesieben07
05/22/2021, 5:01 PMflatMapMerge
is just one of them. RXJS does something similar, it has mergeMap
, switchMap
and concatMap
, all of which could be called "flatMap".dniHze
05/22/2021, 5:07 PMflatMapLatest
or flatMapMerge
.
For me the concern is that newcomers just going for flatMap
, which is deprecated. And while IDE is a brilliant tool and will teach you in 1 min that the replacement is a flatMapMerge
, it's still a confusing thing.flatMap
is deprecated, and flatMapMerge
is FlowPreview scoped. That should hit hard an unprepared for experimental APIs person.okarm
05/22/2021, 8:52 PMflatMap
was never actually used, it only exists so that the IDE can steer people looking for flatMap
towards the more explicit naming of flatMap(Concat|Merge|Latest)
with the replacement quick fix.
@Deprecated(
level = DeprecationLevel.ERROR,
message = "Flow analogue is 'flatMapConcat'",
replaceWith = ReplaceWith("flatMapConcat(mapper)")
)
CLOVIS
05/23/2021, 8:29 AMdniHze
05/23/2021, 8:49 AM