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

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 the QA Contact for the bug.

Received on Tuesday, 28 January 2014 19:20:52 UTC