Re: Resolving Futures w/multiple values

* Dave Longley wrote:
>In order to convert this continuation-passing style API to a Future, a 
>wrapper creates a new function that wraps the async operation and passes 
>a callback that will call reject() if a non-null 'err' parameter is 
>defined and resolve() with an array containing both 'bar' and 'baz' 
>otherwise. The code to use such a wrapper and its resulting Future might 
>look like:
>
>futureFoo = wrap(foo);
>futureFoo(param1, param2).done(function(value) {/*value is [bar, 
>baz]*/}, function(err) {})
>
>This will be a bit odd for anyone used to using the library, but it is 
>at least usable, unless 'bar' can be either an array or an object and 
>'baz' is optional. Then the results are indeterminate.

I don't see the problem here. `value` would never be `bar`, it would be
`[bar, ...]` because you always box the value to avoid this problem.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Wednesday, 24 April 2013 15:01:58 UTC