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

Re: [WebIDL] Remove string constants

From: James Graham <jgraham@opera.com>
Date: Thu, 20 Oct 2011 12:55:50 +0200
Message-ID: <4E9FFE36.7020808@opera.com>
To: Jonas Sicking <jonas@sicking.cc>
CC: public-script-coord@w3.org
On Thu 20 Oct 2011 11:08:20 AM CEST, Jonas Sicking wrote:
> On Thu, Oct 20, 2011 at 1:18 AM, James Graham<jgraham@opera.com>  wrote:
>> On 10/20/2011 07:26 AM, Jonas Sicking wrote:
>>> On Wed, Oct 19, 2011 at 7:25 PM, Anne van Kesteren<annevk@opera.com>
>>>   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.
>>> However, there still is an argument for the constant, which is that it
>>> enables feature detection.
>> The other argument is that they make it easier to implement an IDE with code
>> completion. I don't know if this is enough to make up for the fact that they
>> are long and ugly.
> Given that I'd prefer for people to not write Foo.BAR and rather write
> "bar" (since the latter is faster), I don't think this is a good
> argument.

It's not really faster if you only use the interface irregularly and so 
have to look up how to spell "bar" every time whereas your IDE will 
tell you about Foo.BAR.

>> A third argument is that it is well known that constants are always
>> uppercase so one doesn't need to remember whether it is "2d" or "2D".
> The details, such as capitalization, of strings should be rememberable
> enough that this shouldn't be a problem.

Well I found it a problem for <canvas> context names at least. Again, 
if you use it all the time it isn't a problem but in that case I didn't 
and there wasn't sufficient precedent to establish a 
lowercase-always-everywhere rule.

Anyway possibly I am starting to sound like someone who cares. I'm not 
sure that I am.
Received on Thursday, 20 October 2011 10:56:29 UTC

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