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

编程入门 行业动态 更新时间:2024-10-27 05:24:04
本文介绍了JavaScript 中的延迟/承诺概念是一个新概念还是函数式编程的传统部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很喜欢 jQuery 的延迟/承诺模式或范式的想法,但有时我无法将我老化的大脑围绕在更精细的点或特定的实现细节上.

I really like the idea of jQuery's deferred/promise pattern or paradigm but sometimes I have trouble wrapping my aging brain around the finer points or specific implementation details.

事实上,最近我发现延迟/承诺模式/范式似乎早于 jQuery,并且至少也在这些其他 JavaScript 库/框架中:

In fact recently I've found that the deferred/promise pattern/paradigm seems to predate jQuery and is also in at least these other JavaScript libraries/frameworks:

延期githubQ 主页task.js 主页when.js githubwire.js github、演示YUI gallery-deferred 模块

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

I've probably missed some, included stuff that's really part of one of the others, and made other mistakes in that list... Please edit it to correct it or leave comments.

延迟/承诺概念是Q"发明的吗?它是与其他 JavaScript 库或框架一起发明的吗?还是它完全早于 JavaScript?

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

或者函数式编程完全不是重点?与函数式编程相比,这个概念是否与并发编程更相关?

推荐答案

根据维基百科:术语promise 是由 Daniel P. Friedman 和 David Wise 于 1976 年提出的,Peter Hibbard 称其为最终的.1977 年,Henry Baker 和 Carl Hewitt 在一篇论文中介绍了一个有点相似的概念未来.

见:维基百科上的期货和承诺历史:

future 和/或 promise 构造首先在MultiLisp 和 Act 等编程语言 1. 逻辑的使用并发逻辑编程语言中的通信变量与期货非常相似.这些都是从 Prolog with Freeze 开始的和 IC Prolog,并与 Relational 成为真正的并发原语语言、并发序言、保护喇叭子句 (GHC)、Parlog、Vulcan、Janus、Mozart/Oz、Flow Java 和 Alice ML.这来自数据流编程语言的单赋值 I-var,起源于 Id 并包含在 Reppy 的并发 ML 中,很像并发逻辑变量.

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.

promise 流水线技术(使用期货来克服延迟)由 Barbara Liskov 和 Liuba Shrira 于 1988 年发明,[12] 和由 Mark S. Miller、Dean Tribble 和 Rob Jellinghaus 独立完成大约在 1989 年的 Xanadu 计划的背景.[13]

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]

术语承诺是由 Liskov 和 Shrira 创造的,尽管他们通过名称 call-stream 引用流水线机制,它是现在很少用了.[...]

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 中的延迟/承诺概念是一个新概念还是函数式编程的传统部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-03-30 02:50:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/768622.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:是一个   新概念   函数   概念   传统

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!