Replies: 1 comment
-
|
Original reply by @myitcv in cuelang/cue#914 (comment) @verytable sorry for the slow response here. Lists and structs have a default value of the empty list or struct respectively: gives: I think the quote from the spec "Lists can be thought of as structs" is meant to illustrate another way of thinking about lists, but I can see how it is misleading in light of the above. The behaviour of your example: has changed with respect to |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Originally opened by @verytable in cuelang/cue#914
General question. Do lists work well with defaults? If they don't I think this should be explicitly mentioned in docs.
My doubts are based on the following quote from docs:
that shows that List has default (*) in it's definition. Also there are no list examples in the "Default values " section of the docs.
Example.
Evaluation of the following code (with cue 0.3.2)
{ arr: [...string] | [] } & {arr: *[] | [...string]}results in
arr: incomplete value [] | []However, this
{ arr: [...string]} & {arr: *[] | [...string]}results in
{ "arr": [] }The first example also works with cue 0.2.2.
What is the difference between these two snippets?
Beta Was this translation helpful? Give feedback.
All reactions