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

# vs _# and capitalization #686

Answered by mpvl
extemporalgenome asked this question in Q&A
Discussion options

You must be logged in to vote

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 details and discussion. The solution then is to write:

i…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@extemporalgenome
Comment options

@mpvl
Comment options

@mpvl
Comment options

Answer selected by extemporalgenome
Comment options

You must be logged in to vote
0 replies
Comment options

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
3 participants