- From: Martin Thomson <martin.thomson@gmail.com>
- Date: Fri, 15 Feb 2013 11:51:32 -0800
- To: Adam Bergkvist <adam.bergkvist@ericsson.com>
- Cc: Justin Uberti <juberti@google.com>, "public-webrtc@w3.org" <public-webrtc@w3.org>
On 13 February 2013 23:00, Adam Bergkvist <adam.bergkvist@ericsson.com> wrote: > On 2013-02-13 23:31, Martin Thomson wrote: >> interface RTCStatsReport { >> getter RTCStatsObject (DOMString identifier); >> }; > I asked this question on the public-script-coord list yesterday [1] and it > seems like both approaches are fine. > > If there was a "(hash)map" counterpart to sequence<T> in WebIDL (something > like map<KeyT, ValueT>) I think that would be the thing to use. The result > represented in JavaScript would just be an object in that case. The thing > that I don't like with (1) is that it introduces a new type that doesn't > really add much. The only thing that differentiates it from any other > map-like object, someone else might want to specify, is that it may only > contain stats objects. I know that at least WebKit is moving away from > special array-like objects to more reusable constructs. I'm not sure it > would be right to go to start introducing special map-like objects. > > What do you browser implementers think about this? Let's be clear, we've already agreed what it looks like in JavaScript in a browser. That's the only thing that really matters. When it comes to specification, pick whatever is clearest and easiest to understand. I asked Travis about this and here was his guidance: > Browser implementers have this sort of functionality available on a variety of existing DOM objects, such as the "window" object, the "dataset" object, the "localStorage" object, etc. In all of these case, the objects are true interfaces [...] > > Whether you want this to be a dictionary or an interface depends on: > 1) if you want the retrieval action to be a function or a property getter (property getter must be an interface) > 2) if you expect multiple calls to the object to get the same instance each time (same instance must be an interface) Based on this, I would prefer to specify as dictionary unless there was a reason to upgrade to interface. Downgrade to prose doesn't seem necessary. It makes the basic behaviour harder to discover when reading the spec.
Received on Friday, 15 February 2013 19:52:00 UTC