Skip to content
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

Reject incomplete defaults #30

Open
sdboyer opened this issue Sep 11, 2021 · 2 comments
Open

Reject incomplete defaults #30

sdboyer opened this issue Sep 11, 2021 · 2 comments
Assignees
Labels
kind/feature New feature or request

Comments

@sdboyer
Copy link
Contributor

sdboyer commented Sep 11, 2021

With the model we're pursuing for generating defaults, it doesn't make sense to allow non-concrete default values. That means any of these cases should result in an error:

A: int | *string
B: "foo" | *("bar" | "baz")
C: "foo" | "bar" | *_|_

Not sure how realistic/important C is, but the other two definitely are.

@sdboyer sdboyer added the kind/feature New feature or request label Sep 11, 2021
@sdboyer sdboyer changed the title Reject non-concrete defaults Reject incomplete defaults Sep 11, 2021
@ying-jeanne ying-jeanne self-assigned this Oct 4, 2021
@ying-jeanne
Copy link
Collaborator

currently when we import case C into cue, c.Default() would return false with value |.

for a normal case when cue.Value doesn't have default, the function Default() return also false with value |. we need to think if we want to manage case C, then a walk around would be needed :).

@sdboyer
Copy link
Contributor Author

sdboyer commented May 5, 2022

Interestingly, i now know that this dovetails with another subtle challenge - the v.Default() where v.IncompleteKind() is cue.List is almost always itself. That means that determining whether a list instance actually has a default value is largely about checking whether the default differs from the input.

This is in contrast to every other Kind of value. Lists are weird.

@sdboyer sdboyer removed this from the 8.2.1 milestone May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants