Skip to content

# vs _# and capitalization #686

Answered by cueckoo
cueckoo asked this question in Q&A
Jul 3, 2021 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Original reply by @mpvl in cuelang/cue#686 (comment)

This is a relatively new thing and the documentation needs to be updates. For details see https://cuelang.org/docs/references/spec/#definitions-and-hidden-fields

But in short, exported definitions (those starting with #) are visible outside your package, whereas hidden ones are not. If you don't intend to share a package, then it doesn't matter much.

There is one case where this is important though. Consider

import "acme.com/foo"

a: foo.#Def & {
    #foo: {...}
   a: #foo
   b: #foo
}

Adding a definition to a struct is currently allowed in CUE, even if foo.#Def doesn't define it. This will be disallowed in v0.4.0. See #543 for more de…

Replies: 2 comments 3 replies

Comment options

cueckoo
Jul 3, 2021
Collaborator Author

You must be logged in to vote
3 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

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
Category
Q&A
Labels
None yet
1 participant