TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Async/await support in Firefox

454 pointsby dallamaneniover 8 years ago

11 comments

chinhodadoover 8 years ago
Is there an article or book where the major "ways" of doing concurrency in different languages are explained and compared? E.g. thread process mutex semaphore etc. in Java et al, callback promise async await in JS, goroutine channel in Go, task async await plinq in C#, asyncio in Python, etc. It would be nice to have a general overview of these, what their pros and cons are and why.
评论 #12851440 未加载
评论 #12851448 未加载
评论 #12852152 未加载
评论 #12851506 未加载
评论 #12851628 未加载
评论 #12851666 未加载
notgoodover 8 years ago
Great news.<p>FYI Chrome will ship with async&#x2F;await support[0] in the next stable version (55, so it&#x27;s already on Chrome Canary).<p>[0]<a href="https:&#x2F;&#x2F;bugs.chromium.org&#x2F;p&#x2F;v8&#x2F;issues&#x2F;detail?id=4483" rel="nofollow">https:&#x2F;&#x2F;bugs.chromium.org&#x2F;p&#x2F;v8&#x2F;issues&#x2F;detail?id=4483</a>
评论 #12851893 未加载
awalGargover 8 years ago
Note that async functions <i>always</i> return native promises. So if you like your fast or sugary promise libraries, you can&#x27;t make async functions return those promises. You are stuck with the native promises, which, as of now, are pretty slow in almost all engines in comparison to the heavily optimized promise library bluebird.<p>I guess we should just hope that engines will optimize their own promise implementations. This might not matter much in front-end apps, but absolutely does for Node apps.<p>Other than that, I believe it is time JS gets: 1. An actually useful try&#x2F;catch (with pattern matching on the catched errors) 2. Standard stack traces across all engines<p>Those two will really help async&#x2F;await.
评论 #12854127 未加载
评论 #12853433 未加载
评论 #12854810 未加载
jrvidalover 8 years ago
I am a JS programmer and I have mixed feelings about this. I am not entirely sold on the stuff that comes <i>after</i> async&#x2F;await. In particular, I am curious to know what folks here think about cancelable promises [1] and the try...else block that might be introduced. Or about async iterators [2], where you can `yield await` stuff.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-cancelable-promises" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-cancelable-promises</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-async-iteration" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-async-iteration</a>
评论 #12852926 未加载
tlrobinsonover 8 years ago
I&#x27;m really looking forward to not having to debug my code compiled to state machines.<p>Is there a good way to get Babel&#x2F;Webpack to emit multiple versions of your code compiled with different features enabled, then load the right bundle?
评论 #12851952 未加载
评论 #12852062 未加载
aboodmanover 8 years ago
Biggest advance in JavaScript since ... I don&#x27;t even know. XHR? Reasonable GC performance?
评论 #12851381 未加载
评论 #12851522 未加载
评论 #12853063 未加载
评论 #12853417 未加载
评论 #12853360 未加载
Bahamutover 8 years ago
I have one major misgiving about async-await - the regression in needing to do a try-catch if one isn&#x27;t isn&#x27;t a test situation. This is a terrible syntax to have to write to handle this.<p>That said, async functions also introduce a fundamental language shift in how one parses JS. One can now block execution to return a value, but no longer know if the innards of a function is blocking, which could mean that your function execution is blocked by an async execution. Instead of what one may know as async by looking at a promise or any other similar construct for handling async flow like observables, this will be the source of many bugs in developers&#x27; code as we shift in mindset, should this become popular. This would definitely improve readability of code written using continuation passing style though.<p>Minus the awful try-catch, I&#x27;m not necessarily against async-await being the norm, but its broad effects on how async code will be written should be recognized, especially considering that it doesn&#x27;t solve a fundamental issue like something like observables do.
评论 #12851778 未加载
评论 #12851837 未加载
评论 #12851665 未加载
评论 #12851658 未加载
评论 #12851731 未加载
yladizover 8 years ago
Am I alone in the boat that feels that the way that async&#x2F;await is implemented in JS is a little wonky? I kind of prefer that you can do `await asyncFunc(...)` without having to denote the function itself as `async`, but I don&#x27;t like that you can just call the `asyncFunc` without `await` and it would still potentially do something. In Python, when you `await` something, it actually runs the code, whereas running the function by itself just returns a Future that hasn&#x27;t been started.<p>I feel like it&#x27;s less difficult to shoot yourself in the foot with Python&#x27;s implementation, because you know that if you&#x27;re calling an asynchronous function, you have to `await` it or it won&#x27;t work and won&#x27;t have side effects. In JS, you could call the async function without awaiting it and it could have side effects which could produce subtle bugs that aren&#x27;t easy to find.
fergieover 8 years ago
Still not entirely sure what the big win with async&#x2F;await is. Is it just a readability thing? Is there one &quot;killer&quot; case that demonstrates its superiority over callbacks?
评论 #12855862 未加载
评论 #12853332 未加载
评论 #12853355 未加载
评论 #12853313 未加载
评论 #12853409 未加载
ilostmykeysover 8 years ago
Why would we want to mix async and sync behavior in one cognitive space? That seems counter evolutionary.
评论 #12852549 未加载
mark242over 8 years ago
Dear Javascript coders:<p>If you wind up writing the word &quot;await&quot; in your codebase more than once, you&#x27;re doing it wrong. You will quickly see how futures&#x2F;promises wind up taking over all of your code. This is a very good thing. You shouldn&#x27;t need to block, ever.<p>Sincerely,<p>Scala coders
评论 #12851828 未加载
评论 #12851916 未加载
评论 #12851826 未加载