Sunday, 29 January 2017

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 details.



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:





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.




Was the deferred/promise concept invented by "Q"? Was it invented with some other JavaScript library or framework? Or does it predate JavaScript completely?



If the whole idea has traditionally been part of functional programming, where was it first done and where can I read about the concept generally rather than these various different JavaScript implementations?



Or is functional programming entirely beside the point? Is the concept more related to concurrent programming than to functional programming?


Answer



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



No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...