Re: APIs that overload numbers and strings

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