Closed benlesh closed 6 years ago
Tangent: In a world with Turbofan, the hypothetical addition in 4 above should just be array.flatMap((a, i) => toOtherArray.map((b, ii) => a + b))
.
(Again, that's a total tangent, not related to what I was talking about above, which is asking whether we really want the thisArg
or not)
I agree that thisArg
is not useful.
However, because of symmetry, I think it needs to be on flatMap.
Agreed with @ljharb. It pretty much has to be there for symmetry, but I don't expect many people to use it. Thanks for opening the issue for visibility, but I'd rather avoid any unnecessary changes to the proposal to maximise its chances of advancing to stage 3 at the next meeting.
@ljharb that's fine! :) I don't disagree... I just wanted to try. I've never liked thisArg
, and I keep being asked and/or needing to add it to RxJS. haha.
Is
thisArg
still relevant in a world wherebind
is so much more efficient? I understand it might be provided out of symmetry with other methods likemap
orfilter
, but:bind
is much much faster than it used to be.someType.method(myFunction, arbitraryObject)
vssomeType.method(myFunction.bind(arbitraryObject))
flatMap
you'll be stuck behind athisArg
, and how will you control thethisArg
for that?array.flatMap((a, i) => toOtherArray(a), (a, b, i, ii) => a + b)
(whereb
andii
are from the inner array)... (I'm not suggesting this as a feature, it's a hypothetical)