W3C home > Mailing lists > Public > public-webrtc@w3.org > May 2013

RE: Stats interface - possible change in WebIDL documentation format

From: Jim Barnett <Jim.Barnett@genesyslab.com>
Date: Wed, 15 May 2013 14:29:08 +0000
To: Harald Alvestrand <harald@alvestrand.no>
CC: "public-webrtc@w3.org" <public-webrtc@w3.org>
Message-ID: <57A15FAF9E58F841B2B1651FFE16D28103F3E9@GENSJZMBX02.msg.int.genesyslab.com>
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.


-          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:29:39 UTC

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