javascript - ES7 中新的 async 和 await 关键字是从 C# 复制过来的吗?

标签 javascript c# asynchronous async-await ecmascript-2016

<分区>

注意到 Java 中没有 async 和 await,ES7 中的这些新关键字是从 C# 语言复制而来的?我很好奇起源:谁提出了关键字名称,JS 社区中是否有人正在利用 .NET 框架的概念?

最佳答案

使用 promises(或 futures 等)的概念正变得越来越流行,但这并不新鲜。例如,您可以在 MultiLisp 中找到它。

asyncawait 关键字最近在 C# 中使用,现在正在传播到许多其他语言中。

Several mainstream languages now have language support for futures and promises, most notably popularized by the async and await constructions in .NET 4.5 (announced 2010, released 2012) largely inspired by the asynchronous workflows of F#, which dates to 2007. This has subsequently been adopted by other languages, notably Dart (2014), Python (2015), Hack (HHVM), and drafts of ECMAScript 7 (JavaScript), Scala, and C++.

是的,JS 是从 C# 借来的。

来自 Futures and promises#History

关于javascript - ES7 中新的 async 和 await 关键字是从 C# 复制过来的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34206654/

相关文章:

c# - 为什么 ASP.NET 似乎以不同方式处理框架和 Web 应用程序抛出的异常?

c# - 当模型中的属性更改时得到通知

javascript - 你如何将文本字段从模态传递到父级?

javascript - 错误 : Value for argument "value" is not a valid query constraint. 无法使用 "undefined"作为 Firestore 值

javascript - 使整个 div 可点击(调用函数)

c# - VB.NET - 线程池和在 c# 中委托(delegate)给 VB.NET

javascript - 异步操作未及时将数据添加到 Redux 存储导致错误 : Cannot read property 'map' of undefined

javascript - 我的 React 组件不会在 Safari 浏览器中更新

c# - 如何在没有 C# 类的情况下查找子列表的索引

c# - 如何允许此循环调用异步方法