String enum pattern

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? 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 15:46:04 UTC