cue-lang / cue

The home of the CUE language! Validate and define text-based and dynamic configuration
https://cuelang.org
Apache License 2.0
5.12k stars 293 forks source link

cue eval -H stopped showing hidden fields #615

Open cueckoo opened 3 years ago

cueckoo commented 3 years ago

Originally opened by @verdverm in https://github.com/cuelang/cue/issues/615

broken at this commit: https://github.com/cuelang/cue/commit/b4aa96d77478248fdfe6520c0a57a01628180bf6

cue eval -H hidden.cue
-- hidden.cue --
A: {
        _noshow: "hello"
        isshown: "world"
}
cueckoo commented 3 years ago

Original reply by @verdverm in https://github.com/cuelang/cue/issues/615#issuecomment-749094923

adding a package preamble does work, so is this a semantic change or should this example work?

cueckoo commented 3 years ago

Original reply by @mpvl in https://github.com/cuelang/cue/issues/615#issuecomment-752997064

It's a good question. I don't remember if I did this deliberately, but it makes sense: files from anonymous packages (or files without a package clause) can be combined into a single package at will. Yet, it makes sense to treat the hidden fields of such packages as coming from different namespaces. As we can't display such namespaces, it makes sense to drop them altogether.

If that is really bothersome, we could consider showing hidden fields unconditionally, caveat emptor, as a sort of debugging feature.