W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

Re: Promises: final steps

From: Kevin Smith <zenparsing@gmail.com>
Date: Thu, 5 Sep 2013 15:50:51 -0400
Message-ID: <CA+mDt2zfNTY12fr87j-nBPbS_XKUgrT1ruiQ+twY1TpL=0Thtw@mail.gmail.com>
To: Mark Miller <erights@gmail.com>
Cc: Domenic Denicola <domenic@domenicdenicola.com>, es-discuss <es-discuss@mozilla.org>, "www-dom@w3.org" <www-dom@w3.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
> Please do.
>

You're not going to like it, which will explain my hesitation : )

Think of all promises as existing in a forest, where "root" promises are
created using the Promise constructor and "child" promises are created
using `then`.  Promises with [[Value]] set are green.  Promises with
[[Reason]] set are red.  A "checkpoint" occurs immediately after the
microtask queue has been completely flushed.  At any checkpoint, any
non-root leaf nodes colored red are program errors.

This forces the programmer (me, really) to either write an error handler at
the end of a `then` chain, or to return the chain to a caller that will.
 It also means that I must be strict about when error handlers are attached
to a chain.  There may be important use cases that this strategy precludes
which I haven't yet considered...

{ Kevin }
Received on Thursday, 5 September 2013 19:51:28 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:50 UTC