W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2014

Re: [promises] Guidance on the usage of promises for API developers

From: Takeshi Yoshino <tyoshino@google.com>
Date: Tue, 14 Jan 2014 22:30:05 +0900
Message-ID: <CAH9hSJatxugm0G94xXEVfZXOkDkNrxBFRdJ22QwtB-rnGGcMkw@mail.gmail.com>
To: "www-tag@w3.org" <www-tag@w3.org>
Cc: public-webapps <public-webapps@w3.org>
Nice writing! Both the shorthand phrases and guidance look very useful for
writing Promise based specs.

I have only one comment on this section.
https://github.com/domenic/promises-unwrapping/blob/master/docs/writing-specifications-with-promises.md#maintain-a-normal-control-flow

I agree with your point in the first paragraph, but the suggested way looks
rather confusing. The asynchronous operation abstracted by Promises is well
described, but selling this convention (writing what usually happens later
before return without any annotation) to everywhere sounds too much, I
think. It's good to move "Return p" to the end of the steps. But how about
also keeping "do blah asynchronously" text?

1. Let p be a newly-created promise.
2. These steps will be run asynchronously.
  1. If blah, reject p with undefined.
  2. If blah, resolve p with foobar.
3. Return p.

Thanks
Received on Tuesday, 14 January 2014 13:30:53 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:21 UTC