- From: Harald Alvestrand <harald@alvestrand.no>
- Date: Wed, 15 May 2013 13:59:29 +0200
- To: "public-webrtc@w3.org" <public-webrtc@w3.org>
- Message-ID: <519378A1.1010101@alvestrand.no>
(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 12:00:04 UTC