Hacker News new | ask | show | jobs
Mistakes to Avoid If You Work with Scala Futures (medium.com)
26 points by vigneshwaran 1949 days ago
1 comments

I liked the writeup! In my experience, JavaScript Promise (mis)use can share some of these mistakes too—they're probably inherent to the synchronous->asynchronous learning process.
For other JS developers the stuff about await isn't relevant. It's not the same as a JS async/await

In JS an await is just syntactic sugar around a then() on a promise. The Await in the article is a method to block the thread until a promise resolves, there is no equivalent in JS.

.NET has a similar mechanism with Task.Result with similar pitfalls

Yes. The async/await in JS is totally different from Await in plain Scala (without any frameworks)
What would be the equivalent to “sending tasks” to a Future instead of awaiting result (re mistake 1) but in JS with Promises? Is it about operating on unresolved promises and awaiting final values as late as possible? Or does that part not apply to JS?
The error is explicitly awaiting for the result; "sending tasks" to the future is the correct way, and corresponds to "then" in Promise.
Thank you for your comment. Yes I felt that the problems could be present in other languages as well but I don't know any other.