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

Re: Reconciling handling of optional arguments and handling of default values across ES and webidl

From: Jonas Sicking <jonas@sicking.cc>
Date: Thu, 9 May 2013 23:44:13 -0700
Message-ID: <CA+c2ei8dYX0K330pJywfHquOp33-_G-kkNzUNv6Qy4Tnq6w7dw@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: Garrett Smith <dhtmlkitchen@gmail.com>, Andreas Rossberg <rossberg@google.com>, Allen Wirfs-Brock <allen@wirfs-brock.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On Thu, May 9, 2013 at 8:20 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 5/9/13 5:06 PM, Garrett Smith wrote:
>> drawImage specifies its overload sets (3, 5, 9). Why can't webIdl
>> overload can match the algorithm for that without checking argument
>> types?
>
>
> In this case it does.  Argument type checking only comes into play when more
> than one possible overload matches the passed-in argument count.
>
> And again, for purposes of the undefined discussion what really matters here
> is whether trailing undefined should be counted or not for purposes of the
> argument count for this algorithm.  I guess if we leave arguments.length
> as-is in JS then they should be, for consistency....

We should make the choice of behavior here based on what creates the
most useful/intuitive/consistent API, not based on what
arguments.length contains.

Whatever arguments.length does, any of the options here could be
implemented in JS. I.e. JS code could either check arguments.length,
or it could check which of the arguments had the value 'undefined'.

What makes figuring out what's most useful/intuitive/consistent tricky
in this case is that I don't think that anyone would create a JS API
like this.

/ Jonas
Received on Friday, 10 May 2013 06:45:12 UTC

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