3 ms·
I think this article misses a main point and that's the fact that all await does it take a function that used to be asynchronous and makes it synchronous. While
by coreyja 13y ago
I think this article misses a main point and that's the fact that all await does it take a function that used to be asynchronous and makes it synchronous. While yes, there are definitely use cases where that is nice, in general I think that if you want to use an await command, why are you making a call that was meant to be async? You are defeating the whole point of async calls.
Yes I know a lot of standard libraries have calls that are async and you may not really need for them to be async but I don't think that this is the case often enough that we should abandon callbacks and the like and go back to an age where all code must be synchronous. I know the author isn't saying it to that extreme necessarily, but his comparing callbacks to gotos is extreme as well.
- kvb 13y agoThat's not how async/await work at all. They let you write the code as if it were synchronous, but it's still asynchronous, which is the whole point.
- danabramov 13y agoYou misread the article. The compiler allows you to write code in sequential manner but rewrites it into a state machine with callbacks.