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

Re: APIs that overload numbers and strings

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Sat, 13 Apr 2013 13:41:52 -0700
Message-ID: <CAAWBYDAArLGg52fbNijdchn34iHXZmmir23Zr3dkUoVi3CbrgA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>, Ehsan Akhgari <ehsan.akhgari@gmail.com>
On Sat, Apr 13, 2013 at 1:36 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> Right now WebIDL cannot express an API that overloads a number and a string.
> For example, this:
>
>   void foo(double arg);
>   void foo(DOMString arg);
>
> is not valid WebIDL.
>
> I think I've seen 3 requests in the last several months to lift this
> restriction.  The question is whether we should and if so what the behavior
> should end up being, from an idiomatic JS perspective.
>
> First, the use cases:

Another one: I'm currently noodling over an API that would take either
a filter callback or, for convenience, a JS primitive - if the latter,
it implicitly creates a filter callback that checks if the value is
=== to the passed primitive.  Obviously, numbers and strings would be
very different here.

~TJ
Received on Saturday, 13 April 2013 20:42:38 UTC

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