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

RE: APIs that overload numbers and strings

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Mon, 15 Apr 2013 22:32:17 +0200
To: "'Ehsan Akhgari'" <ehsan.akhgari@gmail.com>, "'Anne van Kesteren'" <annevk@annevk.nl>
Cc: "'Boris Zbarsky'" <bzbarsky@mit.edu>, "'Allen Wirfs-Brock'" <allen@wirfs-brock.com>, <public-script-coord@w3.org>
Message-ID: <005e01ce3a18$53d35cf0$fb7a16d0$@lanthaler@gmx.net>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:12 UTC