Re: Bare values read as "just this value please"

On 8/5/14 3:01 AM, Stefan Håkansson LK wrote:
> I think we're discussing this because it is not obvious. To some (me
> included) a bare value signals "ideal", to others it signals
> "mandatory/exact".

Of course it is not obvious now after we've defined the meaning once as 
inverse! Discussions about meaning are hard. We've spun around too much 
and now we're dizzy. But I think there's still time to fix this (not 
much) so that it's clear long-term.

Taking a step back, I think the right question is: Can someone who is 
seeing this for the first time look at the syntax and figure out the 
rules enough to use it right? For that to work the rules must be 
intuitive and consistent first and helpful second (e.g. don't twist 
meaning out of fear or concern for the outcome, or at least twist it 
consistently).

Clear your mind of the spec and consider this JS call:

   var constraints = { video: { aspectRatio: x } };
   getUserMedia(constraints, success, failure);

I'm not going to tell you what x is yet. Can you answer whether it fails 
or not? I think people would expect this to work the same for all valid 
values of x.

Lets scrutinize the call signature. We used to have the word 
"mandatory", which was pretty strict-sounding, and we all agreed it was 
clear that it could fail then. Well, I think to fresh eyes the word 
"constraint" is just as harsh-sounding! - 
https://www.google.com/search?q=constraint - It is the flexible 
(non-failing) constraint that is the oxymoron (now thankfully hidden 
under "advanced").

The fact that a failure callback is a required argument and that the 
word constraint is harsh-sounding should be enough to expect it to fail, 
I think.

So now I'll tell you what x is. It could be any of these:

   var x = 16/9;
   var x = { max: 16/9 };
   var x = { min: 4/3, max: 16/9 } };
   var x = { min: 4/3, max: 16/9, ideal: 16/9 } };

That's the thing with JS. I think people would expect this to work the 
same for all values of x. The exception is "ideal" whose very name we 
picked to contradict the word constraint on purpose.

People are going to use cut'n'paste + deductive reasoning (anything I 
put in place of x, even an object, follows the same rule).

.: Jan-Ivar :.

Received on Tuesday, 5 August 2014 12:26:59 UTC