javascript - JavaScript 中的延迟/ promise 概念是一个新概念还是函数式编程的传统部分?

标签 javascript functional-programming history promise deferred

我真的很喜欢 jQuery 的延迟/ promise 模式或范例的想法,但有时我无法将我老化的大脑围绕更细微的点或特定的实现细节。

事实上,最近我发现 deferred/promise 模式/范式似乎早于 jQuery,并且至少在这些其他 JavaScript 库/框架中也是如此:

我可能遗漏了一些,包含了真正属于其中一个的东西,并在该列表中犯了其他错误......请编辑它以更正它或发表评论。

延迟/ promise 概念是“Q”发明的吗?它是与其他一些 JavaScript 库或框架一起发明的吗?或者它是否完全早于 JavaScript?

如果传统上整个想法都是函数式编程的一部分,那么它最早是在哪里完成的?我在哪里可以阅读一般概念而不是这些各种不同的 JavaScript 实现?

或者函数式编程完全没有意义?这个概念与并发编程的关系比与函数式编程的关系更密切吗?

最佳答案

According to Wikipedia : promise 一词于 1976 年由 Daniel P. Friedman 和 David Wise 提出,Peter Hibbard 称其为 eventual。 1977 年,亨利·贝克 (Henry Baker) 和卡尔·休伊特 (Carl Hewitt) 在一篇论文中引入了一个有点类似的 future 概念。

参见: Futures and promises history在维基百科上:

The future and/or promise constructs were first implemented in programming languages such as MultiLisp and Act 1. The use of logic variables for communication in concurrent logic programming languages was quite similar to futures. These started with Prolog with Freeze and IC Prolog, and became a true concurrency primitive with Relational Language, Concurrent Prolog, Guarded Horn Clauses (GHC), Parlog, Vulcan, Janus, Mozart/Oz, Flow Java, and Alice ML. The single-assignment I-var from dataflow programming languages, originating in Id and included in Reppy's Concurrent ML, is much like the concurrent logic variable.

The promise pipelining technique (using futures to overcome latency) was invented by Barbara Liskov and Liuba Shrira in 1988,[12] and independently by Mark S. Miller, Dean Tribble and Rob Jellinghaus in the context of Project Xanadu circa 1989.[13]

The term promise was coined by Liskov and Shrira, although they referred to the pipelining mechanism by the name call-stream, which is now rarely used. [...]

关于javascript - JavaScript 中的延迟/ promise 概念是一个新概念还是函数式编程的传统部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11845328/

相关文章:

javascript 和 HTML 成本计算器 - 地毯的值(value) x 房间的大小

python - 一次通过过滤和未过滤的元素

http - ELM-LANG 如何在单击浏览器后退按钮时发出 http 请求

git - 连接两个 Git 存储库的历史记录?

shell - BASH:有没有办法在不活动期间自动将最近的行保存到我的 bash 历史记录中?

javascript - Angular 不在控制台上显示 JavaScript 错误

javascript - 点击剪贴板动画

javascript - 使用自定义属性 <td> 标记将行添加到 DataTable

functional-programming - 函数式编程和声明式编程有什么区别?

python - 在没有 ZIP 的情况下在 python 中成对附加