Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

spec/cycles/Structural_cycles: optional field bug? #145

Closed
rudolph9 opened this issue Oct 5, 2019 · 4 comments
Closed

spec/cycles/Structural_cycles: optional field bug? #145

rudolph9 opened this issue Oct 5, 2019 · 4 comments
Labels

Comments

@rudolph9
Copy link
Contributor

rudolph9 commented Oct 5, 2019

spec/cycles/Structural_cycles

Arguably the following falls under the category of

It is allowed for a value to define an infinite set of possibilities without evaluating to an infinite structure itself.

Foo: {
  foo?: Foo
  bar: string
}

foo: Foo & {
  foo:{ 
    bar: "barNested"
  }
  bar: "barParent"
}

but in the current version of cue it doesn't return (probably eventually a stack overflow error but killed it after like 5 minutes).

$ cue eval optional_structural_cycle.cue
# waiting
# waiting
# waiting
^C

I could also see this fall under the category of an infinite cycle so could use some clarity around if it's a bug with the evaluation or if it just need some clarity in the doc and maybe make sure it's detected in the cycle check that will eventually be rolled #29

@rudolph9
Copy link
Contributor Author

rudolph9 commented Oct 5, 2019

This feature is relevant to a little testing package I'm working on refining, if supported it would allow me to infinitely nest describe scopes https://gist.github.com/rudolph9/eccc978e71fd9c32b0ae182ce6854c16

@jlongtine
Copy link
Contributor

jlongtine commented Oct 5, 2019 via email

@mpvl mpvl added the NeedsFix label Oct 7, 2019
@mpvl
Copy link
Contributor

mpvl commented Oct 7, 2019

I tested this does not work with the new version. This is indeed another case. The current implementation explicitly tests for disjunctions that allow such infinite structure. But optional fields implicitly such a disjunction. And as @rudolph9 correctly notes, the spec allows for such cases.

Note that none of this is related to evaluation, but merely to printing. The engine is happy to compute on infinite structures. It is just the representation of these infinite structures that is causing the trouble.

@cueckoo
Copy link

cueckoo commented Jul 3, 2021

This issue has been migrated to cue-lang/cue#145.

For more details about CUE's migration to a new home, please see cue-lang/cue#1078.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants