W3C home > Mailing lists > Public > public-webrtc@w3.org > June 2012

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

From: Harald Alvestrand <harald@alvestrand.no>
Date: Fri, 15 Jun 2012 08:52:47 +0200
Message-ID: <4FDADBBF.1040500@alvestrand.no>
To: Adam Bergkvist <adam.bergkvist@ericsson.com>
CC: "public-webrtc@w3.org" <public-webrtc@w3.org>
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.

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 07:01:27 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:28 UTC