-
Notifications
You must be signed in to change notification settings - Fork 170
cue: references to ancestor nodes should be direct and not through outer scope #152
Comments
This is not fully correct, but is a trade-off between two wrongs. See Issue #152. The real underlying issue is an incorrect forwarding/ copying of the root struct which is better resolved as part of an overall performance overhaul. Fixes #145 Change-Id: I7fa04d5f16ea6fb09686fb8a0c5864142635eb8c Reviewed-on: https://cue-review.googlesource.com/c/cue/+/3581 Reviewed-by: Marcel van Lohuizen <[email protected]>
Or maybe the way it is now is actually correct. Depending on how a references is interpreted, a reference to root should bind to the copy or not, but it should probably be consistent. |
@mpvl Agreed, either case is probably valid but needs to be consistent. In either case, it should probably factor into the discussion around the |
Relevant comment to this this issue here |
I'm pretty convinced the current behavior is correct now. It is just unfortunate there is this dichotomy. Field aliases mitigate it a bit, as one can alias a possibly shadowed variable. I think it will be possible to detect when users make a mistake and then warn them in a vet command, similar to what Go does. |
Closing for now. |
This issue has been migrated to cue-lang/cue#152. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
If a struct is referred to (and copied), any reference within this copy to the root of the struct should resolve to the root of the copied struct.
Both these cases below should work.
See also Issue #145
The text was updated successfully, but these errors were encountered: