Dictionary-shaped Hammers

Regarding the use of dictionaries for constraints, specifically
mandatory constraints.  Here's where I think that the status of the
debate is at:

Jan-Ivar doesn't want to use something that looks like a dictionary, but isn't.

Harald and Gili are certain that they want a particular behaviour.

(I don't believe that we are completely agreed that mandatory is a
good idea, but let's pretend that it is.)

I think that though the arguments are frequently misleading, both
groups are fundamentally right.  They don't want strictly opposing
things.  So let me propose a solution.

var c = new ConstraintSet();
c.set('width', 1280);
c.set('height', 720);
navigator.getUserMedia({ audio: true, video: { mandatory: c } },
    successCb, failureCb);

Done.

The idea that a dictionary is appropriate here is, at best, a stretch.
 Don't look at every problem and assume that your hammer will work.  A
dictionary is not appropriate for this use case, and pretending that
it is does no favours to anyone.

For backwards compatibility we can use a union type, and we can revert
to incompatible behaviour if that is chosen.  I'd chose the ignore
unknown here, but add a deprecation warning so that people encouraged
not to cause harm to themselves and others.

I think at the point that people from competing browsers are telling
the other that their implementation is wrong, we've lost the plot.
Let's not go there.

Received on Monday, 9 December 2013 17:03:56 UTC