Skip to content Skip to sidebar Skip to footer

Is The Deferred/promise Concept In Javascript A New One Or Is It A Traditional Part Of Functional Programming?

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 deta

Solution 1:

According to Wikipedia: The term promise was proposed in 1976 by Daniel P. Friedman and David Wise, and Peter Hibbard called it eventual. A somewhat similar concept future was introduced in 1977 in a paper by Henry Baker and Carl Hewitt.

See: Futures and promises history on Wikipedia:

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. [...]

Solution 2:

I think in JavaScript deferred/promise concept first appeared in Dojo (inspired by Python's Twisted) then in jQuery.

The notable moment is work of CommonJS group which put a lot effort to "standarize" promises for JavaScript, see A, B and D proposals, on that basis Kris Kowal's Q (I guess currently most popular implementation) evolved.

Deferred (I'm the author) is later implementation, it was initially inspired by Q, its goal is to make promises feel natural in JavaScript, and also to make transition from Node.js callback style easy.

But yes as @rsp wrote, promises are much older concept than JavaScript itself :)

Post a Comment for "Is The Deferred/promise Concept In Javascript A New One Or Is It A Traditional Part Of Functional Programming?"