gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 02:05:55 25 4
gpt4 key购买 nike

我真的很喜欢 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com