Re: Feature-detectable API extensions?

On Tue, Aug 27, 2013 at 3:03 PM, Allen Wirfs-Brock <allen@wirfs-brock.com>wrote:

>
> On Aug 27, 2013, at 2:21 PM, Joshua Bell wrote:
>
> On Tue, Aug 27, 2013 at 2:12 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>
>> On 8/27/13 5:10 PM, Norbert Lindenberg wrote:
>>
>>> Are there argument values for the second argument that are invalid and
>>> will result in an exception?
>>>
>>
>> In this case, yes: passing "" or 0 would throw.
>>
>>
> Is Norbert asking about the existing IDBCursor continue() method?
>
> The current IDL is |void continue(optional any key);| and extra arguments
> don't cause implementations to throw.
>
>
> Getting back to Boris question concerning 'length'...
>
> Based upon the above signature, IDBCursor.prototype.continue.length should
> be 0.  I verified this on FF.
>
> 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) the value of the 'length' of the new form
> should be 1.
>

Hrm. The first argument would still be optional (for compatibility and
since calling with no arguments is the most common case). If you didn't
miss that, then are you saying that a change in signature from:

void continue(optional any key);
to:
void continue(optional any key, optional dictionary options);

...would change the length from 0 to 1? (If so, I'm fuzzier on length than
I thought.)

While you're here: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23056 raises
questions about function length as well.


>
> So the value of the 'length' property could be used to sniff for the new
> capability.
>
> Allen
>

I'm assuming the consensus is still that a new method is better in at least
this case, even if length sniffing could plausibly be used. If anyone
disagrees, please speak up!

Received on Tuesday, 27 August 2013 22:39:26 UTC