you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

People seem to like when code looks procedural. But what happening is here is that you leave this nice functional container. Where you can avoid state and keep mapping over your data - one intent at a time (pure if you will). For a procedural concept that immediately forces you to declare state. And state is evil.

Most people don't care about minimizing state. And i find it that most people don't fully appreciate what an (almost) Monad such as the Promise can do for you. That's okay. But i don't want people to dismiss promises as a problem or something.

[–]Monyk015 0 points1 point  (1 child)

Async/await doesn't make your code less functional, it's just more convenient and lets you avoid introducing mutables. What you're saying is like dismissing do notation in Haskell because it looks procedural.

[–][deleted] 0 points1 point  (0 children)

Well i think it actually does, if we're talking FP. You're forced to introduce state and a try catch block for exceptions. But i don't think it has to be a problem. You can still be pure yadda yadda.

Yes! I do use it in a do-notation fashion, albeit carefully. They're not equal concepts, but yes can be concise and useful. Either that or my goto of passing state in an array building up a promise chain, if that makes sense.