Difference between revisions of "Futures and promises"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(Sinon.js)
(Native JavaScript)
Line 25: Line 25:
 
* [https://www.promisejs.org/ Promises] by Forbes Lindesay
 
* [https://www.promisejs.org/ Promises] by Forbes Lindesay
 
* [http://blogs.fluidinfo.com/terry/2013/09/12/promises-are-first-class-objects-for-function-calls/ Promises are first-class objects for function calls] by Terry Jones
 
* [http://blogs.fluidinfo.com/terry/2013/09/12/promises-are-first-class-objects-for-function-calls/ Promises are first-class objects for function calls] by Terry Jones
 
== Native JavaScript ==
 
 
* [https://developers.google.com/web/fundamentals/primers/promises/?hl=en Promises | Web fundamentals] - Promises have arrived natively in JavaScript
 
* [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise Promise] @ developer.mozilla.org
 
* [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all Promise.all()] @ developer.mozilla.org
 
* [https://davidwalsh.name/promises JavaScript Promise API] by David Walsh
 
* [http://www.html5rocks.com/en/tutorials/es6/promises/ JavaScript Promises] by Jake Archibald
 
* [http://www.datchley.name/es6-promises/ ES6 Promises] by Dave Atchley
 
* [https://www.sitepoint.com/overview-javascript-promises/ Overview of JavaScript Promises] by Sandeep Panda
 
* [http://exploringjs.com/es6/ch_promises.html Promises for asynchronous programming] @ exploringjs.com
 
* [http://javascriptplayground.com/blog/2015/02/promises/ Embracing Promises in JavaScript]
 
* [http://stackoverflow.com/questions/21866986/using-javascript-native-promises-resolve-a-promise-after-thenables-attached Using Javascript native promises, resolve a promise after thenables attached] @ Stack Overflow
 
* [http://stackoverflow.com/questions/21564993/native-support-for-promises-in-node-js Native Support for Promises in Node.js] @ Stack Overflow
 
* [https://60devs.com/best-practices-for-using-promises-in-js.html Best Practices for Using Promises in JS] by Oleksii Rudenko
 
* [http://dailyjs.com/2014/02/20/promises-in-detail/ JavaScript Promises ... In Wicked Detail] by Matt Greer
 
* [https://html5hive.org/how-to-chain-javascript-promises/ How to Chain JavaScript Promises – Intro Tutorial to JavaScript Promises] by Pablo Farias Navarro
 
* [https://pub.clevertech.biz/native-javascript-promises-vs-bluebird-9e58611be22#.w9v7jbqko Native Javascript Promises vs Bluebird] by Nazar Aziz
 
* [https://codepen.io/underthex/pen/yHaAC Pure JS Promise (Native)] by Stenly Tan
 
* [http://engineering.pivotal.io/post/tdd-js-native-promises/ Testing JavaScript's native Promises] by Paul Meskers
 
* [https://www.youtube.com/watch?v=104J7_HyaG4 How to Use Javascript Promises] by Jordan Leigh @ YouTube
 
* [https://msdn.microsoft.com/en-us/library/dn802826(v=vs.94).aspx Promise Object (JavaScript)] @ MSDN
 
 
  
 
== Sinon.js ==
 
== Sinon.js ==

Revision as of 06:30, 25 September 2016

In computer science, future, promise, delay, and deferred refer to constructs used for synchronizing program execution in some concurrent programming languages.

They describe an object that acts as a proxy for a result that is initially unknown, usually because the computation of its value is yet incomplete.

Description

The term promise was proposed in 1976 by Daniel P. Friedman and David Wise; Peter Hibbard called it eventual.

A somewhat similar concept future was introduced in 1977 in a paper by Henry Baker and Carl Hewitt.

The terms future, promise, delay, and deferred are often used interchangeably, although some differences in usage between future and promise are treated below. Specifically, when usage is distinguished, a future is a read-only placeholder view of a variable, while a promise is a writable, single assignment container which sets the value of the future.

Notably, a future may be defined without specifying which specific promise will set its value, and different possible promises may set the value of a given future, though this can be done only once for a given future.

In other cases a future and a promise are created together and associated with each other: the future is the value, the promise is the function that sets the value – essentially the return value (future) of an asynchronous function (promise). Setting the value of a future is also called resolving, fulfilling, or binding it.

See also

External links

Sinon.js

when.js