Re: [ACTION-43] (sdp related objects and global namespace) - way forward

On 2012-06-15 08:52, Harald Alvestrand wrote:
> On 06/14/2012 04:54 PM, Adam Bergkvist wrote:
>>
>>>>
>>>> 3. Come up with a new shorter name that less general and keep the
>>>> objects in the global namespace.
>>>> * PeerSessionDescription
>>>> * PeerMediaDescription
>>>> - SessionDescription doesn't mean that much to the average web
>>>> developer so we could go with Media instead to make the usage
>>>> clearer.
>>> Neither 1 nor 3 move them out of the global namespace.
>>
>> I don't see moving them out of the global namespace as the only
>> solution to this problem (even though that's how the action was
>> formulated). We're already putting a lot of stuff in the global
>> namespace with PeerConnection prefixes. Renaming was also discussed
>> during the meeting.
>
> There's a reason why the action was recorded at it was; I thought that
> once it was pointed out that we could reduce our pollution footprint, it
> was obvious that we should do so.

Sure, but IceCandidate and SessionDescription are only two of the names 
we introduce in the global namespace (others are DataChannel, 
PeerConnectionErrorCallback, ...). I think we need to be consistent or 
determine that some objects are special enough to be treated differently.

I simply wanted to present our alternatives and get some comments from 
the people who had opinions about this on the meeting.

/Adam

> Background:
>
> The global namespace is a horrible misfeature of Javascript.
>
> To quote "Javascript: The Good Parts":
> " JavaScript’s global object [...] is far and away the worst part of
> JavaScript’s many bad parts"
> (appendix E, quoted on
> http://oreilly.com/javascript/excerpts/javascript-good-parts/json.html)
>
> (quick check: Did you know that anything defined to be in browser
> Javascript's global namespace is defined as a property on "Window"? Do
> you know when it is not?)
>
> Not polluting it is good for both our API and the sanity of the world.
>
> Harald
>

Received on Friday, 15 June 2012 10:08:27 UTC