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

Re: [WebIDL] Remove string constants

From: Anne van Kesteren <annevk@opera.com>
Date: Fri, 09 Dec 2011 11:12:44 +0100
To: "Cameron McCormack" <cam@mcc.id.au>
Cc: public-script-coord@w3.org
Message-ID: <op.v57vzjj264w2qv@annevk-macbookpro.local>
On Fri, 09 Dec 2011 03:16:06 +0100, Cameron McCormack <cam@mcc.id.au>  
> On 20/10/11 1:25 PM, Anne van Kesteren wrote:
>> Strings are intrinsically meaningful and therefore have no need for
>> constants in APIs for the platform. See XMLHttpRequest.responseType and
>> the <canvas> 2D API for examples. We should remove string constants so
>> people (e.g. public-web-perf) will not use them and introduce
>> inconsistent APIs.
> This sounds like an argument against string constants used for enum-like  
> values.  (We already convinced the Web Perf folks not to use string  
> constants in this case.)  What about something like:
>    interface A {
>      const DOMString HTMLNS = "http://www.w3.org/1999/xhtml";
>    };
> There are no string constants currently like this (a convenience because  
> people have difficulty remembering such strings), so my question is  
> whether we want to disallow them.

I would expect if we ever decide on some API that needs to work with the  
HTML/SVG/MathML namespaces we would use simple prefixes for them. E.g.  
"svg:svg", "html:a", etc. I'm personally not convinced at least that  
namespaces are a good use case for string constants. And since there is no  
such API currently we can always add this feature later may the need arise.

Anne van Kesteren
Received on Friday, 9 December 2011 10:13:36 UTC

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