On Mon, Sep 24, 2012 at 6:58 PM, Chris Rogers <crogers@google.com> wrote:
>
>
> On Mon, Sep 24, 2012 at 3:31 PM, Ehsan Akhgari <ehsan.akhgari@gmail.com>wrote:
>
>> On Fri, Sep 21, 2012 at 12:03 PM, olivier Thereaux <
>> olivier.thereaux@bbc.co.uk> wrote:
>>
>>> Hi Ehsan,
>>>
>>>
>>> On 21 Sep 2012, at 16:55, Ehsan Akhgari wrote:
>>> > Should we consider using Web IDL enums instead of numeric constants
>>> for things in the spec which are actually enumerated values?
>>>
>>> I recall we had an issue about that. Ah, yes:
>>> https://www.w3.org/Bugs/Public/show_bug.cgi?id=17323
>>>
>>> The bug is currently closed, my bad as I thought we'd fixed all the
>>> IDL-related issues with your recent set of changes. Feel free to reopen it.
>>>
>>> As for you question, if indeed enums are more expressive and closer to
>>> our spec in prose, I see no reason to not use them.
>>>
>>
>> Just to make it clear, it will break the existing implementation in
>> WebKit since the API will change to use strings instead of numbers. Is
>> that OK?
>>
>
> If people feel very strongly, we can move away from the numeric constants.
> But WebKit would continue to also support the old syntax during a certain
> time so we could transition in an orderly fashion.
>
> As far as what style of constants we should use, I don't have a strong
> preference, but would note that WebGL uses numeric constants.
>
> To some extent, it feels like we're moving into bike-shedding territory,
> and I'd like to carefully consider how important any name changes really
> are. These name changes *do* take a toll on the developers who already
> have invested time in writing production code.
>
I don't feel very strongly about this myself. This was brought up in the
code reviews for my patch in Gecko. Using Web IDL strings may result in an
API which is a bit easier to use in JavaScript, since there would be no
need to remember magic numerical constants, and for engines that support
creating DOM bindings out of Web IDL files, they result in better error
checking since the validation code can be generated in the DOM bindings
instead of the implementation of the API, which protect against things like
bugs caused by the engine forgetting to do proper error checking, so all
things being equal, using string Web IDL enums should be a bit better than
numerical constants, but of course it _is_ a spec change which is going to
affect the existing implementations and code targetting Web Audio.
Cheers,
--
Ehsan
<http://ehsanakhgari.org/>