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

[Bug 25048] consider whether an IDL attribute of type Promise<T> should catch exceptions and wrap them up as a rejected Promise like they are for operations

From: <bugzilla@jessica.w3.org>
Date: Fri, 14 Mar 2014 02:37:18 +0000
To: public-script-coord@w3.org
Message-ID: <bug-25048-3890-mWdHszovHa@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=25048

--- Comment #6 from Cameron McCormack <cam@mcc.id.au> ---
(In reply to Domenic Denicola from comment #5)
> > Hmm, what if you had an IDL attribute of a Promise<T> type that throws when assigning?
> 
> Yeah, this is trickier to reason about---mainly because I don't know of a
> reasonable use case for promise attributes with setters. I assume there'd be
> coercion behavior, so e.g. for a Promise<long> attribute these would be fine:
> 
> foo.bar = 5;
> foo.bar = Promise.resolve(5);
> 
> but these would not:
> 
> foo.bar = {};
> foo.bar = Promise.resolve(function () { });
> 
> I would probably again argue that the result should be `foo.bar` set to a
> promise rejected with a `TypeError`, since people would access the result of
> the set via
> 
> foo.bar.then(processValueRepresentedByBar, couldNotGetValue);

That's my initial feeling too.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Received on Friday, 14 March 2014 02:37:20 UTC

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