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

Re: Feature-detectable API extensions?

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Tue, 27 Aug 2013 21:24:50 -0700
Cc: Joshua Bell <jsbell@google.com>, public-script-coord <public-script-coord@w3.org>
Message-Id: <7AE50CCA-A334-48C4-A78A-1204049FC36B@wirfs-brock.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>

On Aug 27, 2013, at 6:50 PM, Boris Zbarsky wrote:

> On 8/27/13 6:03 PM, Allen Wirfs-Brock wrote:
>> Based upon the above signature, IDBCursor.prototype.continue.length
>> should be 0.  I verified this on FF.
> 
> 0 is what's specced in WebIDL right now for this situation...
> 
>> void continue(any key, optional dictionary opts {string primaryKey);
>> 
>> according to the ES6 rules (assuming that the second argument is defined
>> as a ES6 default value parameter)
> 
> It's an odd case.  Dictionaries _are_ in fact something that always has a default value, but they're a somewhat special case that way; most things only have a default value when explicitly given one.
> 
> But further, WebIDL .length doesn't care about default values at all: it's based purely on whether arguments are optional or not.

I think that the appropriate translation of WebIDL to ES6 is that WebIDL "optional" always turns into an ES6 parameter with a default value initializer. If the WebIDL source includes an explicit default value then that value should be used as the ES6 default value.  If the WebIDL does not have an explicit default value then the implicit WebIDL default should be used as the ES6 default value.

If you do this, then the WebIDL length based upon "optional" should match the ES8 length based upon default value initializers.

Allen
Received on Wednesday, 28 August 2013 04:25:25 UTC

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