3 ms·
There is a V8 API to expose Promises directly from native modules, and that can eventually be used to make async functions first-class citizens. async function
by pitaj 10y ago
There is a V8 API to expose Promises directly from native modules, and that can eventually be used to make async functions first-class citizens.
async functions using promises and generators under the hood is a good thing because it allows easy usage between the two forms.
- lossolo 10y agoThis still doesn't solve what I wrote about api, libuv (event loop + IO) that node.js use is also based on callbacks in C, last time i checked discussion about it, there was no plans to change that.
- Matthias247 10y agoThat simply won't change, because that's what node.js (and Javascript) is fundamentally about: An EventLoop, with callbacks that are used to handle events. All the promises and async/await are only sugar around callbacks, so they don't change the fundamental model. A Go like model, with lightweight or real threads and no need for callbacks or promises will also need new synchronization mechnanisms in order to handle preemption and waiting which are currently not in scope of javascript, e.g. mutexes, condition variables, etc.