Well, I agree with Dustin that without some context highlighting IDE it's hard to argue what's happening down that .then chain. (I probably would start with re-indenting such code if I saw it in a codebase)
And async operations are already tough to understand. (Probably that's why some people invented async/await)
So, IMHO, it's a cool approach with all those curried functions, really!
Though in real code (if I had friends to invite) I'd use more declarative way, e.g.:
// parallelall(groceries().then(a).then(b),friends().then(c).then(d))// and then combined.then(results=>{// ...})
there are some libraries actually that have parallel/sequential helpers to get rid of those .then chains, though I haven't found any quickly enough
It's a bit more like a callback hell, I know, yet for me personally this way its easier to understand the sequences and dependencies.
Again, it's a personal opinion. Still, it was interesting for me to read those point-free (?) functions. So thanks, Benny!
P.S. Maybe, the lesson here is that we should mix those approaches.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Well, I agree with Dustin that without some context highlighting IDE it's hard to argue what's happening down that
.then
chain. (I probably would start with re-indenting such code if I saw it in a codebase)And async operations are already tough to understand. (Probably that's why some people invented
async/await
)So, IMHO, it's a cool approach with all those curried functions, really!
Though in real code (if I had friends to invite) I'd use more declarative way, e.g.:
there are some libraries actually that have parallel/sequential helpers to get rid of those .then chains, though I haven't found any quickly enough
It's a bit more like a callback hell, I know, yet for me personally this way its easier to understand the sequences and dependencies.
Again, it's a personal opinion. Still, it was interesting for me to read those point-free (?) functions. So thanks, Benny!
P.S. Maybe, the lesson here is that we should mix those approaches.