rasn icon indicating copy to clipboard operation
rasn copied to clipboard

Constraints do not natively support the case were no values are allowed

Open Nicceboy opened this issue 9 months ago • 2 comments

Sometimes intersection of two constraints can lead into situation where the resulting constraint does not allow any values.

Currently this is solved by either adding impossible value range constraint or a size constraint with zero size, but this should be more explicit.

Maybe this could be even compile-time error, but I am not sure if there are valid use cases.

Value constraint currently:

Bounded::Range {
    start: Some(1),
    end: Some(-1),
},

Nicceboy avatar Apr 05 '25 14:04 Nicceboy

Maybe this could be even compile-time error, but I am not sure if there are valid use cases.

Since it is currently unsupported, moving it to be an error would be a good first step, to ensure that the user is aware of what's happening, and if someone has a use case for it to not be an error, that can be a separate effort.

XAMPPRocky avatar Apr 05 '25 21:04 XAMPPRocky

Currently it is handled with those impossible ranges/ zero size so it is not completely ignored (those are set when no value is allowed).

So there will be correct constraint validation error when encoding/decoding, but the main problem is that it can be confusing and maybe those impossible ranges conflict with something else.

Nicceboy avatar Apr 05 '25 21:04 Nicceboy