-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with hidden refs/lists/modules #1613
Comments
Hidden values / fields do not cross package boundaries, similar to how private works in Go. That is why it works when they are in the same package, but does not when using imports (which themselves require a module setup). Arguably, this could emit an error. #629 is related in that packages are left open after import, which is likely to change. |
@mattklein123, separately, CUE uses the txtar file format from Go's source to nice reproducers & examples https://github.com/cue-lang/cue/wiki/Creating-test-or-performance-reproducers |
Got it, OK. Sorry about that.
OK, I see. FWIW this is not very intuitive, given that hidden variables are a way to hide input from the output. An error would be very nice here, thank you. |
I've been thinking about this more, and it seems like not being able to pass hidden "inputs" into a module makes modules much less powerful than they could be. Obviously, the caller could be aware of the "in" and "out" pattern, but then the caller has to do the filtering for fields that shouldn't be in the final output which breaks the abstraction. Any thoughts on this? Any other pattern I should be using? |
You can use There is also the "function" pattern and proposed syntactic sugar (#943) |
I want to make sure I'm not missing something obvious, but I don't see any way to hide the input value from the ouput.
Obviously in this case "in" is part of the output. I understand that I can assign |
I'd write the input field as a definition instead, per this example. |
Ah, thank you @seh. I think this is the piece I was conceptually missing. I didn't realize definitions could be nested in this way. Very cool! |
@mattklein123 It seems like you no longer consider this an issue. I'll close it accordingly. Please re-open if you still think this is a bug, thanks. |
I think this is a bug but I'm not completely sure. I found this issue in a much larger example and boiled it down to a much smaller case, that AFAICT seems to require the use of modules vs. putting everything in the same package and running all cue files together.
test.cue
lib.cue
I would expect
out
to contain["hello"
. And in fact if I switch_in
_ toin
it does.I think this is a bug but I'm new to all of this so let me know. :) Thank you.
The text was updated successfully, but these errors were encountered: