RE: a question on style for arguments

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?

Thanks,
Jim

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