-
Hi, As part of the experimentation I'm doing with cue I wanted to write a simple cue specification to validate other cue specifications. The problem is that I'm not getting the same results for cue The way I perform the test is by unifying a test
But on testing a structure with a simple comprehension
On
while v0.2.2 returns
Is this a bug? Am I expecting the wrong result from a comparison with bottom? Thanks for your help |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 6 replies
-
If anyone is curious, the idea for the testing schema to be able to write tests as follows
And through
|
Beta Was this translation helpful? Give feedback.
-
You might try the $ cat or.cue
keys: ["a", "b"]
testB: or(keys) & "b"
testC: or(keys) & "c"
$ cue eval or.cue
keys: ["a", "b"]
testB: "b"
testC: or(keys) & "c"
$ cue eval -c or.cue
testC: empty disjunction v0.3.0 is a significant rewrite of the evaluator, and in theory should be more correct (pending any remaining bugs). |
Beta Was this translation helpful? Give feedback.
-
Hi @verdverm, thanks for your reply. Here is the full example
With cue 0.2.2
With cue 0.3.0-alpha5
Using the
Which maybe means I'm misunderstanding how comprehensions should evaluate? I would expect the result of |
Beta Was this translation helpful? Give feedback.
-
This seems related to #475. See #475 (comment). Especially the coined terminology of "open disjunctions" seems relevant here. Basically, the use of We need to find the right balance here. Note that we also intend to add This is a nice example, though, and I've added it to #475. I think here that the evaluator should at some point recognize that growing the size of The good thing is that although this is a complicated matter and these bugs are hard to understand, the user generally won't have to think about the distinction and won't be confronted with it once the bugs are gone. |
Beta Was this translation helpful? Give feedback.
-
This discussion has been migrated to cue-lang/cue#601. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
Beta Was this translation helpful? Give feedback.
This seems related to #475. See #475 (comment).
Especially the coined terminology of "open disjunctions" seems relevant here.
Basically, the use of
_|_
can give rise to non-monotonic behavior if not done properly. Comparing against_|_
is akin to a logical not, which is a questionable construct. So the mechanism in place here is preventing this.v0.2
was really poor at this, butv0.3
is probably too aggressive at doing so. This actually happens all over the place already (looking of a non-existing field in an open struct is incomplete, while for a closed struct it is fatal, for instance), but this case is particularly tricky.We need to find the right balance here. Note that we also inten…