Skip to content

Struct openness in definition #527

Answered by cueckoo
cueckoo asked this question in General
Jul 3, 2021 · 2 comments · 6 replies
Discussion options

You must be logged in to vote

Original reply by @myitcv in cuelang/cue#527 (comment)

Can you clarify what you are trying to achieve with your #A definition? Because currently (emphasis important, see below) it is equivalent to:

#A: {
        c: {
                {
                        [string]: #B
                }
                foo: _
                bar: _
        }
}

which basically says that all the fields of c (including foo and bar) must be of type #B. This constraint does not preclude additional fields beyond foo and bar, just so long as those additional fields are of type #B.

In the near future (not yet implemented), the semantics are going to change to those detailed in the spec: https://tip.cuelang.org…

Replies: 2 comments 6 replies

Comment options

cueckoo
Jul 3, 2021
Collaborator Author

You must be logged in to vote
6 replies
@cueckoo
Comment options

cueckoo Jul 3, 2021
Collaborator Author

@cueckoo
Comment options

cueckoo Jul 3, 2021
Collaborator Author

@cueckoo
Comment options

cueckoo Jul 3, 2021
Collaborator Author

@cueckoo
Comment options

cueckoo Jul 3, 2021
Collaborator Author

@cueckoo
Comment options

cueckoo Jul 3, 2021
Collaborator Author

Answer selected by cueckoo
Comment options

cueckoo
Jul 3, 2021
Collaborator Author

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant