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 12:55:13 +0200
Message-ID: <4FDB1491.6070201@alvestrand.no>
To: Adam Bergkvist <adam.bergkvist@ericsson.com>
CC: "public-webrtc@w3.org" <public-webrtc@w3.org>
On 06/15/2012 12:07 PM, Adam Bergkvist wrote:
> 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.

Tommy promised to provide more information on this, but apparently stuff 
that doesn't have constructors isn't accessible from the global JS 
namespace, so doesn't pollute in the same way - the names are only 
visible internally in the IDL specifications.

We do provide constructors for PeerConnectionEvent, 
PeerConnectionIceEvent, MediaStreamTrackEvent, MediaStreamEvent and 

Dom, do all events require constructors?

MediaStream provides a constructor, but only for making a mediastream 
out of track lists.
getUserMedia seems to be the only other name we expose in the 
getUserMedia spec.

> /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:55:49 UTC

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