Re: CHANGE: Remove numeric constants from WebRTC API

On 01/10/2012 10:10 AM, Harald Alvestrand wrote:
> Hello group, and happy 2012!
>
> One of the last discussions of 2011 was the discussion triggered by Tab
> Atkins about numeric constants in the API: he strongly recommended
> against them, and recommended that we instead use strings (possibly in
> the special form of WebIDL enumerations, which are mapped to JavaScript
> strings by the language binding.
>
> It seems to me clear from the discussion that:
>
> - The WebIDL community is strongly in favour of such a change
> - There has been weak or no real opposition to the idea in the WebRTC WG
> - If such a change is to be made, it is better to do it as soon as
> possible, so that implementations don't have to change after significant
> deployment of code has been made.
>
> But it's a bit of work, and I don't want to ask the editors to do it if
> there's the possibility that the WG could decide not to do it anyway.
>
> I'm therefore calling for the WG's consensus to do this change.
> It affects at least the following:
>
> - MediaStreamTrack: readyState (LIVE, MUTE and ENDED)
> - PeerConnection: readyState, iceState and sdpState
>
> In all four cases, the current "const unsigned short" declarations woudl
> be replaced with strings; as I understand the enum spec from WebIDL [1],
> this:
>
>       const unsigned short LIVE = 0;
>       const unsigned short MUTED = 1;
>       const unsigned short ENDED = 2;
>       readonly attribute unsigned short readyState;
>
> would become this:
>
>       enum ReadyStateType { "live", "muted", "ended" };
>       readonly attribute ReadyStateType readyState;
>
> Please comment on this - the chairs will attempt to draw a conclusion
> based on mail arrived on Tuesday, Jan 17, at 9AM GMT (7 days from now).

(In a contributor role:) I think we should do this change. This seems to 
be where the community at large are going, and not following now could 
very well result in that we have to make the change later on (e.g. 
during the public review period).

>
>                      Harald, for the chairs
>
> [1] http://dev.w3.org/2006/webapi/WebIDL/ - latest draft 5 Jan 2012
>

Received on Thursday, 12 January 2012 08:54:18 UTC