Replies: 3 comments 6 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: !falseevaluates to: a: >"A" & <"C"
b: 2
c: trueMy 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: >minevaluating to min: 1
max: >1
min: *1 | int
min: <max
max: >min
min: 1 // default taken
max: >1What 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.
-
|
This is now planned for v0.14. The implementation is currently in master. |
Beta Was this translation helpful? Give feedback.
-
|
This has been running as default for a while. We will permanently enabled this for v0.15. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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 & intshould 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 & <5to<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