W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2013

Re: Resolving Futures w/multiple values

From: Dave Longley <dlongley@digitalbazaar.com>
Date: Tue, 23 Apr 2013 14:46:28 -0400
Message-ID: <5176D704.5080409@digitalbazaar.com>
To: Domenic Denicola <domenic@domenicdenicola.com>
CC: www-dom@w3.org
On 04/23/2013 02:20 PM, Domenic Denicola wrote:
> Just as yoy can't return (or throw) multiple values from a function, 
> so you can't fulfill (or reject) a promise with multiple values. 
> Promises model asynchronous return/throw and the associated call 
> stack, so multiple fulfillment values would be nonsensical.
> You may find 
> http://domenic.me/2012/10/14/youre-missing-the-point-of-promises/ helpful?

I understand the desire to make something analogous to synchronous 
programming. However, sometimes analogies can be taken too far; it may 
be a mistake to hold so rigidly to an analogy that we miss out on useful 
functionality that improves upon the model we are analogizing. One 
example of this would be the calculator UI Microsoft built to imitate a 
hand-held calculator from the 1970's.

We don't have the same single return-value restrictions in modern 
asynchronous programming -- and developers have been taking advantage of 
that to write more expressive APIs. That this new ability has been 
embraced is both an indicator that maybe it should continue -- and a 
reason for Futures to support it.

Dave Longley
Digital Bazaar, Inc.
Received on Tuesday, 23 April 2013 18:45:30 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:20 UTC