- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Thu, 11 Apr 2013 16:43:54 -0700
- To: www-dom@w3.org
Task.js has two convenience functions, now(x) and never(), which return a resolved or cancelled promise, respectively. This is useful when combining plain values with the promise algebra, so the combinators don't need to ducktype their arguments to try and guess whether they're a promise or a plain value. (Plus, it lets you easily create a promise which resolves to a promise and use it in the combinators.) Separately, there's been discussion over at the PromisesAPlus github about more explicitly supporting the fact that promises are monadic, by defining a point/pure/return function that just returns a "default" (fulfilled) promise from a base value <https://github.com/promises-aplus/resolvers-spec/issues/24>. Supporting these use-cases seem useful and simple. We should add Future.of(val) and Future.never() convenience static functions to the Future interface. ~TJ
Received on Thursday, 11 April 2013 23:44:41 UTC