Re: Stats interface - possible change in WebIDL documentation format

On 05/15/2013 04:29 PM, Jim Barnett wrote:
>
> But why require the developer to pass the id into the getter if it’s 
> an attribute of the instance?  Why not just have a get() method with 
> no arguments?  What if the developer passes in a different id?  It 
> seems odd to have a method with an argument that has only one legal value.
>

Ah - sorry, I was looking at the wrong getter.

You're right - the argument to the getter inside the RTCStats needs to 
be named something else.

fieldName?

> -Jim
>
> *From:*Harald Alvestrand [mailto:harald@alvestrand.no]
> *Sent:* Wednesday, May 15, 2013 9:05 AM
> *To:* Jim Barnett
> *Cc:* public-webrtc@w3.org
> *Subject:* Re: Stats interface - possible change in WebIDL 
> documentation format
>
> On 05/15/2013 02:29 PM, Jim Barnett wrote:
>
>     What is the relationship between the id attribute of the RTCStats
>     interface and the id argument passed to the getter?  It seems
>     confusing to me to have an object with an ‘id’ attribute and then
>     a getter method that takes some other id.
>
> They are the same (the only valid reason to use the same name).
>
>
> -Jim
>
> *From:*Harald Alvestrand [mailto:harald@alvestrand.no]
> *Sent:* Wednesday, May 15, 2013 7:59 AM
> *To:* public-webrtc@w3.org <mailto:public-webrtc@w3.org>
> *Subject:* Stats interface - possible change in WebIDL documentation 
> format
>
> (Theory-laden subject ahead... this should affect our WebIDL, but not 
> our Javascript. People who only care about the Javascript can skip this.)
>
> In an unrelated discussion this month, I learned something I hadn't 
> really considered before:
>
> In a dictionary, all members are by definition optional.
>
> This affects the stats interface specification. Currently we have:
>
> interface RTCStatsReport {
>     getter RTCStats (DOMString id);
> };
>
> dictionary RTCStats {
>     DOMHiResTimeStamp timestamp;
>     RTCStatsType      type;
>     DOMString         id;
> };
>
> And then all the other RTCStats objects are defined as subtypes of 
> this dictionary.
>
> But - timestamp, type and id are NOT intended to be optional. Thus, 
> the IDL does not provide the maximum amount of information to the user.
>
> One suggested approach, keeping the dictionaries for the rest of the 
> stuff, would be:
>
> interface RTCStats {
>     DOMHiResTimeStamp timestamp;
>     RTCStatsType      type;
>     DOMString         id;
>     getter Any(DOMString id);
> }
>
> // Empty dictionary to serve as the base for further dictionaries
> dictionary RTCStatsBase {
> }
>
>
> with the comment "The id argument to the RTCStats getter is 
> constrained to be a valid member of the RTCStatsBase dictionary or a 
> subtype thereof".
>
> Question to the group:
>
> - Does anyone care?
> - Does the proposed solution make sense (both as WebIDL and as 
> documentation)?
>
>           Harald
>
>

Received on Wednesday, 15 May 2013 14:35:41 UTC