Discussion:
Contiguous IDL and overloaded functions
Mark Watson
2016-07-19 22:21:58 UTC
Permalink
Hi all,

I have two functions in one interface:

appendBuffer( ArrayBuffer data );
appendBuffer( ArrayBufferView data );

The oldschool-to-contiguous tools leaves me with two
<dfn>arrayBuffer</dfn>'s which ReSpec doesn't like. How do I make these
definitions different ? I have tried adding various attributes to the <dfn>
entries, but no luck.

I guess I have the same issue as https://github.com/w3c/respec/issues/536,
but that doesn't offer any help.

...Mark
Marcos Caceres
2016-07-20 03:32:10 UTC
Permalink
Post by Mark Watson
Hi all,
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);
};

Loading...