Rename mergeMap back to flatMap for v6?
See original GitHub issuePrior to v5, the mergeMap
operator was named flatMap
, which is a term coined from functional programming in general. While v5 was being developed there was a lot of discussion and in the end it was thought by a majority of the people involved that renaming it to mergeMap
would help newcomers better grasp what it does, as well as align with the names of the other merge operators.
Now thatās been a couple years with mergeMap
, and rxjsās popularity has continued to explode, IMO mergeMap
hasnāt been as helpful as predicted, and I think we underestimated how many people have prior knowledge of the term flatMap
, and prefer it over mergeMap
. This may also change drastically if JavaScript gets Array.prototype.flatMap
as proposed. Additional facts: .NET calls it SelectMany
but all other Rx implementations I can find use flatMap
@staltz has a great summary below of why it was felt flatMap
was too ambiguous in the context of Rx: https://github.com/ReactiveX/rxjs/issues/3006#issuecomment-339787756.
Iād like to open discussions on the possibility of renaming mergeMap
back to flatMap
for v6. To be 100% clear, I have no official sway in the decision, except that I might bribe some of the core team members. š.
Civil arguments for or against are of course welcome, but please donāt comment with +1 or thumbs up š Use the github āreactionsā on this post below
Issue Analytics
- State:
- Created 6 years ago
- Reactions:63
- Comments:20 (13 by maintainers)
š because functional programmingās
flatMap
is ambiguous in RxJS, it has these options:switchMap
,mergeMap
,concatMap
,exhaustMap
are all āflatMapā.In fact, Array.prototype.flatMap is much more like Rx
concatMap
than it is likemergeMap
.Iāve been teaching these operators in workshops and students really appreciate the consistency
mergeAll
āmergeMap
concatAll
āconcatMap
switch
āswitchMap
How about renaming it to
flatMap
, makingmergeMap
the alias, and then switching the names around again for v7?Edit: š