W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

Re: WebIDL generated TypeErrors and promises

From: Marcos Caceres <w3c@marcosc.com>
Date: Fri, 28 Jun 2013 16:15:41 +0100
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: public-script-coord@w3.org
Message-ID: <4828220E8EF14F45B4A168AF234C965C@marcosc.com>

On Friday, June 28, 2013 at 4:07 PM, Boris Zbarsky wrote:

> On 6/28/13 11:01 AM, Marcos Caceres wrote:
> > Ok, but this potentially breaks WebIDL… maybe kinda… I think most specs assume that WebIDL does its thing, then algorithmic prose runs.
> That's how it works, yes.
> > This would mean that specs that use promises need to be written as:
> >  
> > [[
> > When the foo(V) method is invoked:
> Won't work, because that prose is not entered until after WebIDL does  
> its thing. In particular, WebIDL is what defines the [[Call]] of the JS  
> function.

Oh yeah… you are totally right.  
> If we want a different behavior here, it needs to be specified in WebIDL.
> > 1. do type conversion on V as per WebIDL, and let error be any exception thrown. If an exception is thrown, run the promise's
> Which promise's? The exception is getting thrown before a promise ever  
> gets created in this case.

Sorry, I should have created the promise in the prose… I realized that after I pressed send. But anyway, I guess it won't work regardless for the reason you mention above.   

I think this is a problem, as it might catch people out. People might thing that using a promise won't raise an exception and will always be routed to the error resolver. The only way around this would be to make all types "any" for arguments and then do the type checking in prose… which kinda defeats a large part of the purpose of WebIDL.   
Received on Friday, 28 June 2013 15:16:12 UTC

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