by userbinator · 7y ago · 0 comments
success = doOneThing()
&& doSecondThing()
&& doThirdThing()
...
&& doLastThing();
and the more common "traditional" way: success = doOneThing();
if(success)
{
success = doSecondThing();
}
if(success)
{
success = doThirdThing();
}
...
if(success)
{
success = doLastThing();
}Instead of loading up every language with stupid keywords that are meant to simplify monadic code (but only for one domain), language designers should really take a page out of Haskell or Scala's book and think seriously about unifying on a do notation/for comprehension type construct.
That way regardless of if you're working with promises or not, you don't have to worry about hacking it with && or nesting 10 layers deep with if/else.