Re: Bug 23935 - Proposal: New syntax for constraints

On 12/03/2013 10:47 PM, Jan-Ivar Bruaroey wrote:
> On 12/3/13 3:53 PM, Jim Barnett wrote:
>>
>> Sorry, I wasn’t clear.  I was referring to the request for new values 
>> ‘max’, ‘min’ and ‘mid’, where {width: max} would mean “make it as 
>> wide as you can”.  “min” would ask for the minimum possible value, 
>> and ‘mid’ would mean “try for something in the middle of the range”.
>>
>
> As with anything in life, asking for the maximum without knowing what 
> it is strikes me as a very bad idea. Would you ask the Hulk to hit you 
> as hard as he can? Amount of Advil? Your app can already specify any 
> number of absolute values or ranges of values it knows about (and 
> hopefully has been tested with) Can you give me a use-case where this 
> is not sufficient?
>
> If expressiveness is a problem, we should address this directly, which 
> is what I believe my syntax proposal does. I can say:
>
> [ { width: 4096, height: 2160 },
>   { width: 3840, height: 2160 },
>   { width: 2880, height: 1800 },
>   { width: { min: 1024, max: 4096 }, height: { min: 768, max: 2160 }, 
> aspect: { min: 1.6, max: 1.9 } ]
>
> In this example, I prefer certain resolutions I have tested with (even 
> when higher ones are available), and only if I cannot get one of those 
> exact ones will I accept a range, but no less than 1024x768. How would 
> you express that today?

Actually, this is ALMOST legal current syntax.

{ optional: [ { width: 4096, height: 2160 },
   { width: 3840, height: 2160 },
   { width: 2880, height: 1800 },
   { width: { min: 1024, max: 4096 }, height: { min: 768, max: 2160 }, 
aspect: { min: 1.6, max: 1.9 } ]
}

would be legal syntax if we allowed multiple constraints per element in 
the optional sequence; the argument for not doing so is that we haven't 
specified what happens if we have two constraints in a single element, 
one of which can be satisfied and the other one cannot be.

I could be convinced of relaxing that constraint more easily than I 
could be convinced of changing to an "OR of ANDs" syntax.

Received on Wednesday, 4 December 2013 10:14:22 UTC