Hacker News new | past | comments | ask | show | jobs | submit login

You can recurse and branch just fine, you just lose for/while loops.

Recursing can build up very long promise chains if you aren't careful and also just isn't a natural way for many programmers to express many kinds of code.

Even simple branching gets nasty in many cases if, for example, one branch does something async while the other does not.

You also lose try/catch.

Yeah, agreed. It's functional, but technically weak.

This might be a place to introduce functional pipelines like Haskell's Pipes, Machines, Conduits. They solve the effectfull iteration and streaming problem, but the mechanism is heavily transformer based.

The problem is that while you can introduce FP abstractions to structure your programs, they are not the same abstractions that you use in the synchronous (imperative) code. You still end up in a situation where your programs is written in two colors that don't play nice with one another (for example, a "foreach" combinator doesn't work on both sync callbacks and async callbacks)

Applications are open for YC Winter 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact