Open cueckoo opened 3 years ago
Whilst the use case behind this felt compelling at the time, I really haven't found another use case yet. Which is perhaps telling, so closing this for now.
Re-opening per an exchange with @rogpeppe and @sdboyer on Slack. Not because the approach above is what we need/want, but as a place for further discussion about concrete examples, designs etc.
Originally opened by @myitcv in https://github.com/cuelang/cue/issues/576
Is your feature request related to a problem? Please describe.
Consider:
Now consider how we would declare
y
such that it should be a#Person
with default values taken from those ofx
:i.e. we end up repeating the structure of
#Person
.Describe the solution you'd like
Something like
structs.ToDefault(v cue.Value)
which takes a struct value (closed or otherwise) and returns a struct valueres
where for each fieldx
onv
,res: x: *v.x | _
.Questions to answer:
Describe alternatives you've considered
As above, writing everything out "by hand"
Additional context
n/a