W3C home > Mailing lists > Public > spec-prod@w3.org > July to September 2016

Re: Contiguous IDL and overloaded functions

From: Marcos Caceres <w3c@marcosc.com>
Date: Tue, 19 Jul 2016 23:32:10 -0400
Message-ID: <CAAwChxPa8pECSknQkRLhbtdYA7yr2Q8DeicVsgikj9Ey1nXc_Q@mail.gmail.com>
To: Mark Watson <watsonm@netflix.com>, spec-prod@w3.org
On July 20, 2016 at 8:23:28 AM, Mark Watson (watsonm@netflix.com) wrote:
> Hi all,
>
> I have two functions in one interface:
>
> appendBuffer( ArrayBuffer data );
> appendBuffer( ArrayBufferView data );
>
> The oldschool-to-contiguous tools leaves me with two
> arrayBuffer's which ReSpec doesn't like. How do I make these
> definitions different ? I have tried adding various attributes to the
> entries, but no luck.

I would recommend making a typedef, which captures both types. That
also solves having to overload the method (which is not really a thing
in JS).

http://heycam.github.io/webidl/#idl-typedefs

Like:

typedef (ArrayBuffer or ArrayBufferView) WhatevsBuffer;

interface Foo {
  void appendBuffer(WhatevsBuffer);
};
Received on Wednesday, 20 July 2016 03:32:52 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 20 July 2016 03:32:53 UTC