W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2010

Re: String enum pattern

From: Alex Russell <slightlyoff@google.com>
Date: Tue, 30 Nov 2010 14:14:47 -0800
Message-ID: <AANLkTinuh3DSJt=g4C4oWwyAWg+f8uuFgxrYaq_Xn1V=@mail.gmail.com>
To: Anne van Kesteren <annevk@opera.com>
Cc: public-script-coord@w3.org
On Tue, Nov 30, 2010 at 7:45 AM, Anne van Kesteren <annevk@opera.com> wrote:
> Quite a number of APIs use string values instead of enums as they are more
> flexible when changes occur and such. E.g. this happens in canPlayType,
> quite a few things on the canvas API, and responseType in XMLHttpRequest.
> Should this pattern be endorsed by giving it some type in Web IDL?

I think it should, in part to kill the tyranny of C-style enum integer
values when folks design new APIs.

> This
> could make it easier to see from the IDL what values are allowed. And for
> attributes that allow setting the behavior of ignoring unknown values and
> such could maybe be defined centrally so that everyone using this pattern
> uses it in the same way.
> --
> Anne van Kesteren
> http://annevankesteren.nl/
Received on Tuesday, 30 November 2010 22:15:46 UTC

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