Re: Constraints 2014

On 3/20/14 2:04 PM, Stefan Håkansson LK wrote:
> On 20/03/14 00:50, Jan-Ivar Bruaroey wrote:
>> Extension #2: ideal
>> ===================
>>
>> dictionary ConstrainLongRange {
>>       long min;
>>       long max;
>>       long ideal;
>> };
>>
>> dictionary ConstrainDoubleRange {
>>       double min;
>>       double max;
>>       double ideal;
>> };
>>
>> Ideal expresses a target value within an acceptable range, with values
>> closer to the ideal more desirable.
> Interesting concept (which I guess could be applied to the existing
> design as well).

Sure, it reduces reliance on optional order which boosts readability, 
much like min and max did when they were introduced.

> Should there be an error check on if ideal is withing the bounds set by
> min and max?

We can throw whatever we throw for max < min, or just clamp it (min <= 
ideal <= max). I'm open either way.

.: Jan-Ivar :.

Received on Thursday, 20 March 2014 23:02:40 UTC