Re: Dictionary-shaped Hammers

Hi Martin,

I agree with Jan-Ivar on the need for forward-compatibility, but 
disagree on the way to achieve that.

I object to any solution that allows the API to silently ignore user 
error (e.g. typos). What makes the situation a bit tricky is that typos 
are a subset of "unknown constraints" :)

My only objection to your wonderful Hammer is that last part ("I'd chose 
to ignore unknown here").

Kind regards,
Gili

On 09/12/2013 12:03 PM, Martin Thomson wrote:
> 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 18:58:14 UTC