-
Notifications
You must be signed in to change notification settings - Fork 287
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
need alias type to support binding to embedded scalar #620
Comments
Original reply by @mpvl in cuelang/cue#620 (comment) Ah, I see the issue. The argument to What we want is aliases. However, there are no aliases that allow one to do this easily now. We recently proposed two forms that may address this:
and
Both would be equivalent. Syntactically it would make sense to support both. Either way, it seems that with embedded scalars the need for aliases of embeddings or values has become more pertinent. |
Original reply by @seh in cuelang/cue#620 (comment)
There, within |
Original reply by @verdverm in cuelang/cue#620 (comment) My intention was that I could invalidate the definition when the constraints are imposed. I don't think we want them to automatically apply so that one could have an intermediate and want to apply constraints on that as well. The nice thing about embedded scalars is that it simplifies the "function" syntax For example:
|
Original reply by @myitcv in cuelang/cue#620 (comment) @verdverm I think you intended Also related to the general discussion above (in the context of |
Original reply by @mpvl in cuelang/cue#620 (comment) With field aliases,
results in Similarly, for aliases to embeddings,
refers to the embedded scalar Note that we can use this notation to refer to the struct itself. So in
which refers to the field looked up in the outer scope, which binds differently. It is this difference which is actually quite useful and a workaround to another problem. |
Original reply by @seh in cuelang/cue#620 (comment) Thank you for the explanation. I'm trying to reconcile that with what you wrote here: cuelang/cue#620 (comment). Are you describing CUE as it works as of version 0.3.0-beta.1, or are you describing a proposed change in how it could work? |
Original reply by @mpvl in cuelang/cue#620 (comment) Note that https://cue-review.googlesource.com/c/cue/+/9543/1 implements "field value" aliases, allowing:
So instead of writing
one could write the following to achieve exactly the same:
To the user this may be the same thing, and it may be weird we support one form, but not the other. The main reason why only this is supported is because the |
Original reply by @myitcv in cuelang/cue#620 (comment) @verdverm @seh I think we're resolve here with the arrival of value aliases in |
Originally opened by @verdverm in cuelang/cue#620
In alpha-6
Bug with embedded scalars, we'd like to be able to do this, correct?
Seems like the definition is being evaluated to early. Adding default value to the
let s = ...
shows the value is being taken too soon (i.e. Cue is not lazy enough ;)Using a default value takes that value not the one set on the last line.
The text was updated successfully, but these errors were encountered: