Replies: 1 comment 2 replies
-
I agree with the 2nd point regarding simplification of non-concrete validators. For the first point, this does make sense to me only because it is kind of a unique side-effect of working within such discrete data types. This behaviour isn't even consistent with itself currently. Consider the following: a: string
a: >"A"
a: <"C"
b: int
b: >1
b: <3
c: bool
c: !false evaluates to: a: >"A" & <"C"
b: 2
c: true My expectation is that we get Are the examples in the full details completely correct? I do not observe the same evaluations in the CUE playground (or locally with evalv3). For me the 2nd example would go: min: *1 | int
// min: <max
max: >min evaluating to min: 1
max: >1
min: *1 | int
min: <max
max: >min
min: 1 // default taken
max: >1 What is the "expected" result in this example? I expect the behaviour since a preference is defined. I'm curious to know what other simplification could be expected or useful. |
Beta Was this translation helpful? Give feedback.
-
To improve the predictability and consistency of CUE’s validator behavior by disallowing the unification of two non-concrete values into a concrete value. This eliminates inconsistencies in bound simplifications and simplifies reasoning about constraint reductions.
Proposal
Disallow unification of two non-concrete values into a concrete value. For instance:
>=1 & <2 & int
should not simplify to1
.Disallow the simplification of non-concrete validators. For instance,
<=(<3)
should not simplify to<3
, but rather be an (incomplete) error.For clarity, we will keep allowing simplifications of the unification of two concrete validators, like
<3 & <5
to<3
.Full details here: https://github.com/cue-lang/proposal/blob/main/designs/language/3775-simple-validators.md
Beta Was this translation helpful? Give feedback.
All reactions