RE: APIs that overload numbers and strings

On Monday, April 15, 2013 7:14 PM, Ehsan Akhgari wrote:
> On Mon, Apr 15, 2013 at 12:11 PM, Anne van Kesteren wrote:
> On Mon, Apr 15, 2013 at 5:01 PM, Ehsan Akhgari wrote:
> > Hmm, OK, that seems fine, albeit ugly.
> You could always do enum LegacySomething { "1" , ... }; and enum
> Something and then have (LegacySomething or Something) as "type". But
> yes, if you want to preserve the old API it's going to be ugly either
> way.
> 
> That's a good idea, a bit better than mixing the values in a single
> enum...

That wouldn't be valid, would it? As far as I understand the WebIDL spec enums aren't distinguishable and thus (LegacySomething or Something) is invalid, isn't it?

See http://www.w3.org/TR/WebIDL/#dfn-distinguishable


Cheers,
Markus


--
Markus Lanthaler
@markuslanthaler

Received on Monday, 15 April 2013 20:32:51 UTC