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: Tue, 28 Jan 2014 19:20:50 +0000
To: public-script-coord@w3.org
Message-ID: <bug-24291-3890-uir26MG09r@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=24291

--- Comment #12 from Cameron McCormack <cam@mcc.id.au> ---
(In reply to Tab Atkins Jr. from comment #11)
> 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.

I still don't understand why auto-wrapping is bad.  Sure, you get an extra
Promise object to wrap the plain Response object, but that makes it simpler to
define respondWith in the spec.  You don't need to handle two cases, just one.

I also don't understand how the presence of auto-wrapping and lack of
promises-in-union-types has to do with the fact that you can't invert:

  e.respondWith(cache.get(e.requestURL))

to:

  cache.get(e.requestURL).then(e.respondWith.bind(e))

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Received on Tuesday, 28 January 2014 19:20:52 UTC

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