Killing `Promise.fulfill`

Mark S. Miller erights at google.com
Wed Aug 21 18:08:39 PDT 2013


On Wed, Aug 21, 2013 at 6:04 PM, Tab Atkins Jr. <jackalmage at gmail.com>wrote:

> On Wed, Aug 21, 2013 at 6:00 PM, Brendan Eich <brendan at mozilla.com> wrote:
> > Mark S. Miller wrote:
> >>
> >>
> >>     Cool.  That means we get a decent naming precedent for the monad
> ops,
> >>     and consistency with Array.of (which also happens to be a monadic
> >>     lifter, if you limit yourself to calling it with only a single
> >>     argument).
> >>
> >>
> >> I agree that this naming analogy is a good thing. I raise my approval
> >> magnitude to +1 ;).
> >
> >
> > Bart: Are we there yet?
> > Homer: Just a little further...
> > Bart: Are we there yet?
> > Homer: Just a little further...
> > etc.
> >
> > Can someone summarize for those of us who accidentally skipped a bunch of
> > unread messages here? It sounds good from the last post ;-).
>
> Yup!
>
> 1. Keep Promise.resolve() as it currently works (but make sure that it
> merely adopts promises passed to it, rather than deep-flattens).
> 2. Rename Promise.accept() to Promise.of() (for consistency with
> Array.of, and to provide a better naming base for monads in the
> future).
> 3. Kill PromiseResolver#accept().
> 4. Make Promise() called without new analogous to String/etc - passing
> it a promise returns the argument unchanged, passing it anything else
> wraps it in a fresh promise.
>

Assuming that we can polyfill this new-vs-non-new behavior test reliably on
ES5. Otherwise we still need a static method such as Promise.as().



>
> ~TJ
>



-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130821/52beede0/attachment.html>


More information about the es-discuss mailing list