Re: Bug 23935 - Proposal: New syntax for constraints

On 12/13/13 2:43 PM, cowwoc wrote:
> I don't see how you could express the following constraints all at once:
>
>  1. For aspect ratio 4/3, require resolutions from 800x600 to
>     1600x1200, prefer 1200x900
>  2. For aspect ratio 16/9, require resolutions from 1280x720 to
>     1920x1080, prefer 1600x900
>

Here you're saying "I must have these mandatory constraints OR these 
other mandatory constraints". That's way beyond what you can express 
today! That hardly seems fair. How come you didn't like my declarative 
syntax then?

With my original declarative syntax this is a piece of cake:

[
   { width: 1200, height: 900 },
{ width: 1600, height: 900 },
   {
     aspect: { min: 1.33, max: 1.34 },
     width: { min: 800, max: 1600 },
     height: { min: 600, max: 1200 }
   },
   {
     aspect: { min: 1.77, max: 1.78 },
     width: { min: 1280, max: 1920 },
     height: { min: 720, max: 1080 }
   },
]

Can I write you down as supporting it? ;-)

The best you can do in our compromise proposal here based on the 
loveable optional-array algorithm, is make this optional-only and check 
the result from gUM() (because the optional-array algorithm is 
procedural in nature). That version looks identical to the above btw.

So yeah, call gUM twice and don't blame me for that. The old mandatory, 
which 'required' is based on doesn't have OR logic.

Unless... (please no-one except Gili and Martin read further)

Because there's very little reason not to merge two required entries 
together, it means we could overload the algorithm and say it only needs 
to satisfy ONE required entry. E.g. set a flag on the first 'required' 
found, and delay the jumping to Constraint Failure to the end if none of 
the 'required' ones apply. Then you could say:

[
   { width: 1200, height: 900 },
{ width: 1600, height: 900 },
   {
     required: true,
     aspect: { min: 1.33, max: 1.34 },
     width: { min: 800, max: 1600 },
     height: { min: 600, max: 1200 }
   },
   {
     required: true,
     aspect: { min: 1.77, max: 1.78 },
     width: { min: 1280, max: 1920 },
     height: { min: 720, max: 1080 }
   },
]

It starts to get complicated though, but that's like saying a monkfish 
with a scar is ugly.

.: Jan-Ivar :.

Received on Friday, 13 December 2013 21:06:40 UTC