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

[Bug 24291] Add a Promise type to WebIDL, and make it not distinguishable from anything

From: <bugzilla@jessica.w3.org>
Date: Thu, 23 Jan 2014 08:08:18 +0000
To: public-script-coord@w3.org
Message-ID: <bug-24291-3890-DQAUf8v5jL@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=24291

--- Comment #11 from Tab Atkins Jr. <jackalmage@gmail.com> ---
(In reply to Boris Zbarsky from comment #10)
> That all explains why passing Promise<Response> is a good idea.  Why is
> passing a Response a good idea?  And why would automatically wrapping it in
> a Promise be a bad idea?

Because that's what you're actually doing!  You respond with a Response. 
That's the semantics you want; we only allow Promise<Response> because some of
the APIs naturally return that, and it's more convenient as I explained.

Requiring a Promise<Response> means extra boilerplate for the author to cast it
into a Promise.  Auto-wrapping means consing up a Promise that'll immediately
get unwrapped and thrown away, since it'll automatically unwrap (and risking
triggering thenable coercion, too).  It seems silly.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Received on Thursday, 23 January 2014 08:08:19 UTC

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