Closed briancavalier closed 9 years ago
So far, my personal take is that join(a,b,c).spread(f)
obscures intent. If your real goal is to call f(a, b, c)
, then I think when.try(f, a, b, c)
communicates that goal more clearly.
The action item here seems like it should be to write the section in the anitpatterns wiki.
Additionally, maybe the only other thing we can do is to try to use when.try()
instead of join().spread()
in examples where possible.
Brian, I found this comment to be very helpful in tidying up my own code. The when.try pattern was indeed a much better fit.
@brandoncarl Oh, nice, thanks for letting me know. Glad it helped!
Added to the wiki here. Closing.
The exact same outcome can be achieved with:
I think both
when.join
andpromise.spread
still have use cases separate from each other, but I'm having trouble seeing why using them together (when.join(a, b, c, ...).spread(f)
) would have any advantages.Anyone have any thoughts?
If it's true, then I'm not sure what to do, except to try harder to steer people toward
when.try/lift
in examples.