W3C home > Mailing lists > Public > public-media-capture@w3.org > November 2012

RE: a question on style for arguments

From: Travis Leithead <travis.leithead@microsoft.com>
Date: Wed, 28 Nov 2012 23:45:58 +0000
To: Jim Barnett <Jim.Barnett@genesyslab.com>, "public-media-capture@w3.org" <public-media-capture@w3.org>
Message-ID: <9768D477C67135458BF978A45BCF9B3853AC5338@TK5EX14MBXW603.wingroup.windeploy.ntdev.microsoft.com>
Actually, I think adding the extra "type" isn't bad. In fact this does nothing to pollute the window object, since dictionaries are just descriptions that help user-code create the right properties on vanilla Javascript objects (they don't create types in the JS engine like other interfaces do).

I would however use slightly more distinguishable names:
RecordingFormats -> AvailableRecordingFormats
RecordingFormat -> SuggestedRecordingFormats

From: Jim Barnett [mailto:Jim.Barnett@genesyslab.com]
Sent: Tuesday, November 27, 2012 11:11 AM
To: public-media-capture@w3.org
Subject: a question on style for arguments

In the recording document, we have a getRecordingOptions() function and  setRecordingOptions().  In the initial draft, the return value for getRecordingOptions and the argument for setRecordingOptions were of the same type, namely:

dictionary RecordingFormats {

    sequence<DOMString> containerEncodingFormats<file:///D:\W3C\WWW\webRTC\RecordingProposal.html>;

    sequence<DOMString> audioEncodingFormats<file:///D:\W3C\WWW\webRTC\RecordingProposal.html>;

    sequence<DOMString> videoEncodingFormats<file:///D:\W3C\WWW\webRTC\RecordingProposal.html>;


However when setting the recording options it doesn't make sense to pass in a sequence for any of these items.  The app must chose a single value for the container, the audio encoding and the video encoding.  We could handle this by saying that the sequence must have length 1, but that seems sloppy to me.  I can split it up and define a new dictionary for setting:

dictionary RecordingFormat {

    <DOMString> containerEncodingFormat<file:///D:\W3C\WWW\webRTC\RecordingProposal.html>;

    <DOMString> audioEncodingFormat<file:///D:\W3C\WWW\webRTC\RecordingProposal.html>;

    <DOMString> videoEncodingFormat<file:///D:\W3C\WWW\webRTC\RecordingProposal.html>;


But this adds an extra type that's not very different from an existing one.

Is there some standard solution to this sort of problem?

Received on Wednesday, 28 November 2012 23:47:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:26:12 UTC