Hacker News new | ask | show | jobs
by knome 2210 days ago
I dislike javascript for much the reason you love it.

Promises just mean having to manually build and manipulate cooperatively multitasking green-threaded call-stacks. It was a dirty necessity following the inability of the earlier callback patterns to manage the level of complexity people were attempting to express in the language.

2 comments

Even Rust implemented async/await. It's one of the few nice ways to write asynchronous code.

People who think that it's "manual" only haven't yet discovered the trade-offs of what they think is their preferred solution. There is no free lunch here.

It's like sniping at people who chose different prongs of the CAP theorem while thinking you're somehow in a superior position.

As someone with most of my coding experience in JS/TS, what would you say is a good alternative to explore?
Go with goroutines and channels is a nice way to handle concurrency.

At least it was the one that was easiest for me to wrap my head around and actually improved the performance of my code without weird race conditions or bugs.

Go concurrency is basically threads + the ability to choose between classic mutex synchronization (and all the problems with that like reentrancy bugs) or burn yourself in channel hell with deadlocks and buffer bloat.
Have to you agree with you there. I was pretty hyped for Go some 4-5 years ago but discovered its parallelism/concurrency model was essentially mutexes / condition variables / bounded queues when you get down to it. It's an improvement over doing it manually -- but definitely not a big one.
Erlang / Elixir.
As someone who mainly writes Scala, I really enjoy working with effect types that are also monads. Cats effect, Monix and ZIO are some examples.
Erlang.