-
Notifications
You must be signed in to change notification settings - Fork 298
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
evaluator: export as YAML vs JSON emits different templated data #2916
Comments
I've marked this as an evaluator issue for now. It we can be sure the evaluator has the "right" value here, then we can look at whether/why the encoders handle that differently. |
As discussed, neither are valid i.e. the evaluator should have reported an unresolved disjunction in this situation: Rewriting your example according to the notation used in the spec:
Applying rule U2, you can see that you end up with:
which means we should be left with an unresolved disjunction. What I think you were hinting at here is effectively achieved by:
where |
See previous commit for context. Page-specific notes: * types: - change plaintext hierarchy diagram to mermaid - include top and bottom - explain "cue eval" as we've avoided it until now * bottom: - change values in the example so they pop more visibly - explain what the example is showing * top: [new page] * numbers: - move some prose into the example's comments - mention number type - align tour with spec: `4` is *not* compatible with `float`. - add examples of float-related sugar - move mention of arbitrary precision into here, from docs/tour/types/bounddef/ * stringlit: - rename to mirror "Bytes" - remove comparison to JSON as it feels out of place - include interpolation in the example * stringraw: - expand example to show comparative versions of the same string with different delimiters * bytes: - plain text table changed to markdown - include mention of how to emit a stringified byte array to help avoid newcomer frustration - example expanded to include the same string being output as a string and as bytes' base64, to show the behaviour more clearly - include string interpolation of bytes to demo "how to display some bytes that you know aren't binary data, as a string" - include multiple examples of both hex and octal escapes, and demonstrate their equivalence via unification * structs: - renamed from /optional; alias added - moved ahead of closed and defs to permit for a more natural flow through learning struct concepts - example is changed from a definition to a regular field, as this page now precedes definitions' page. - updated so it's suitable to accept inbound links that previously targeted the language guide * closed: - updated so it's suitable to accept inbound links that previously targeted the language guide * defs: - updated to be a 90% copy of docs/tour/basics/definitions/, as that content is already written. Examples differ. * disjunctions: - revise awkward wording of first sentence, as it's really jarring until the 3rd or 4th read through - stop explaining the example via the prose; use cue-eval-i instead to demonstrate evaluation failure - expand example's disjunction to include 4 values, so as to demo the syntax beyond just 2 elements * defaults: - add explanation of why defaults exist, what CUE does with a default, and when - reuse "options" language from preceding page - make example abstract - include a 3-way disjunction so it's not implied that the default has to unify with the non-default * sumstruct: - show CUE in action in the example * bounds: - more narrative example, including a multi-constraint field - removed the sentence "The bound is defined for all values for which the corresponding comparison operation is defined", as it feels a little too technical for the tour * bounddef: - move mention of arbitrary precision to docs/tour/types/numbers/ - reword "no unsigned integer type" more positively - use cue vet for examples - make all examples fail * lists: - expand explanation - change example to be more narrative, with less prose required for explanation - begin the examples with common, concrete use cases, so users can get what they need from this longer set of eamples more easily, whilst still demonstrating important syntactic detail nearer the end - include sufficient distinct examples so that the various syntaxes implied by the prose have concrete visualisations - include examples of two failure modes that can confuse newcomers * templates: - mention pattern constraints - expand example to include a disjunction-based pattern constraint, and use top for field instantiation where possible - opened cue-lang/cue#2916 * value-constraints: [new page] - left as draft (i.e. not published) following feedback and awaiting later updates For cue-lang/docs-and-content#78 Preview-Path: /docs/tour/types/types/ Preview-Path: /docs/tour/types/bottom/ Preview-Path: /docs/tour/types/top/ Preview-Path: /docs/tour/types/bounddef/ Preview-Path: /docs/tour/types/bounds/ Preview-Path: /docs/tour/types/bytes/ Preview-Path: /docs/tour/types/defaults/ Preview-Path: /docs/tour/types/structs/ Preview-Path: /docs/tour/types/closed/ Preview-Path: /docs/tour/types/defs/ Preview-Path: /docs/tour/types/disjunctions/ Preview-Path: /docs/tour/types/numbers/ Preview-Path: /docs/tour/types/lists/ Preview-Path: /docs/tour/types/stringlit/ Preview-Path: /docs/tour/types/stringraw/ Preview-Path: /docs/tour/types/sumstruct/ Preview-Path: /docs/tour/types/templates/ Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com> Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5
See previous commit for context. Page-specific notes: * types: - change plaintext hierarchy diagram to mermaid - include top and bottom - explain "cue eval" as we've avoided it until now * bottom: - change values in the example so they pop more visibly - explain what the example is showing * top: [new page] * numbers: - move some prose into the example's comments - mention number type - align tour with spec: `4` is *not* compatible with `float`. - add examples of float-related sugar - move mention of arbitrary precision into here, from docs/tour/types/bounddef/ * stringlit: - rename to mirror "Bytes" - remove comparison to JSON as it feels out of place - include interpolation in the example * stringraw: - expand example to show comparative versions of the same string with different delimiters * bytes: - plain text table changed to markdown - include mention of how to emit a stringified byte array to help avoid newcomer frustration - example expanded to include the same string being output as a string and as bytes' base64, to show the behaviour more clearly - include string interpolation of bytes to demo "how to display some bytes that you know aren't binary data, as a string" - include multiple examples of both hex and octal escapes, and demonstrate their equivalence via unification * structs: - renamed from /optional; alias added - moved ahead of closed and defs to permit for a more natural flow through learning struct concepts - example is changed from a definition to a regular field, as this page now precedes definitions' page. - updated so it's suitable to accept inbound links that previously targeted the language guide * closed: - updated so it's suitable to accept inbound links that previously targeted the language guide * defs: - updated to be a 90% copy of docs/tour/basics/definitions/, as that content is already written. Examples differ. * disjunctions: - revise awkward wording of first sentence, as it's really jarring until the 3rd or 4th read through - stop explaining the example via the prose; use cue-eval-i instead to demonstrate evaluation failure - expand example's disjunction to include 4 values, so as to demo the syntax beyond just 2 elements * defaults: - add explanation of why defaults exist, what CUE does with a default, and when - reuse "options" language from preceding page - make example abstract - include a 3-way disjunction so it's not implied that the default has to unify with the non-default * sumstruct: - show CUE in action in the example * bounds: - more narrative example, including a multi-constraint field - removed the sentence "The bound is defined for all values for which the corresponding comparison operation is defined", as it feels a little too technical for the tour * bounddef: - move mention of arbitrary precision to docs/tour/types/numbers/ - reword "no unsigned integer type" more positively - use cue vet for examples - make all examples fail * lists: - expand explanation - change example to be more narrative, with less prose required for explanation - begin the examples with common, concrete use cases, so users can get what they need from this longer set of eamples more easily, whilst still demonstrating important syntactic detail nearer the end - include sufficient distinct examples so that the various syntaxes implied by the prose have concrete visualisations - include examples of two failure modes that can confuse newcomers * templates: - mention pattern constraints - expand example to include a disjunction-based pattern constraint, and use top for field instantiation where possible - opened cue-lang/cue#2916 * value-constraints: [new page] - left as draft (i.e. not published) following feedback and awaiting later updates For cue-lang/docs-and-content#78 Preview-Path: /docs/tour/types/types/ Preview-Path: /docs/tour/types/bottom/ Preview-Path: /docs/tour/types/top/ Preview-Path: /docs/tour/types/bounddef/ Preview-Path: /docs/tour/types/bounds/ Preview-Path: /docs/tour/types/bytes/ Preview-Path: /docs/tour/types/defaults/ Preview-Path: /docs/tour/types/structs/ Preview-Path: /docs/tour/types/closed/ Preview-Path: /docs/tour/types/defs/ Preview-Path: /docs/tour/types/disjunctions/ Preview-Path: /docs/tour/types/numbers/ Preview-Path: /docs/tour/types/lists/ Preview-Path: /docs/tour/types/stringlit/ Preview-Path: /docs/tour/types/stringraw/ Preview-Path: /docs/tour/types/sumstruct/ Preview-Path: /docs/tour/types/templates/ Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com> Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5 Dispatch-Trailer: {"type":"trybot","CL":1177673,"patchset":39,"ref":"refs/changes/73/1177673/39","targetBranch":"alpha"}
See previous commit for context. Page-specific notes: * types: - change plaintext hierarchy diagram to mermaid - include top and bottom - explain "cue eval" as we've avoided it until now * bottom: - change values in the example so they pop more visibly - explain what the example is showing * top: [new page] * numbers: - move some prose into the example's comments - mention number type - align tour with spec: `4` is *not* compatible with `float`. - add examples of float-related sugar - move mention of arbitrary precision into here, from docs/tour/types/bounddef/ * stringlit: - rename to mirror "Bytes" - remove comparison to JSON as it feels out of place - include interpolation in the example * stringraw: - expand example to show comparative versions of the same string with different delimiters * bytes: - plain text table changed to markdown - include mention of how to emit a stringified byte array to help avoid newcomer frustration - example expanded to include the same string being output as a string and as bytes' base64, to show the behaviour more clearly - include string interpolation of bytes to demo "how to display some bytes that you know aren't binary data, as a string" - include multiple examples of both hex and octal escapes, and demonstrate their equivalence via unification * structs: - renamed from /optional; alias added - moved ahead of closed and defs to permit for a more natural flow through learning struct concepts - example is changed from a definition to a regular field, as this page now precedes definitions' page. - updated so it's suitable to accept inbound links that previously targeted the language guide * closed: - updated so it's suitable to accept inbound links that previously targeted the language guide * defs: - updated to be a 90% copy of docs/tour/basics/definitions/, as that content is already written. Examples differ. * disjunctions: - revise awkward wording of first sentence, as it's really jarring until the 3rd or 4th read through - stop explaining the example via the prose; use cue-eval-i instead to demonstrate evaluation failure - expand example's disjunction to include 4 values, so as to demo the syntax beyond just 2 elements * defaults: - add explanation of why defaults exist, what CUE does with a default, and when - reuse "options" language from preceding page - make example abstract - include a 3-way disjunction so it's not implied that the default has to unify with the non-default * sumstruct: - show CUE in action in the example * bounds: - more narrative example, including a multi-constraint field - removed the sentence "The bound is defined for all values for which the corresponding comparison operation is defined", as it feels a little too technical for the tour * bounddef: - move mention of arbitrary precision to docs/tour/types/numbers/ - reword "no unsigned integer type" more positively - use cue vet for examples - make all examples fail * lists: - expand explanation - change example to be more narrative, with less prose required for explanation - begin the examples with common, concrete use cases, so users can get what they need from this longer set of eamples more easily, whilst still demonstrating important syntactic detail nearer the end - include sufficient distinct examples so that the various syntaxes implied by the prose have concrete visualisations - include examples of two failure modes that can confuse newcomers * templates: - mention pattern constraints - expand example to include a disjunction-based pattern constraint, and use top for field instantiation where possible - opened cue-lang/cue#2916 * value-constraints: [new page] - left as draft (i.e. not published) following feedback and awaiting later updates For cue-lang/docs-and-content#78 Preview-Path: /docs/tour/types/types/ Preview-Path: /docs/tour/types/bottom/ Preview-Path: /docs/tour/types/top/ Preview-Path: /docs/tour/types/bounddef/ Preview-Path: /docs/tour/types/bounds/ Preview-Path: /docs/tour/types/bytes/ Preview-Path: /docs/tour/types/defaults/ Preview-Path: /docs/tour/types/structs/ Preview-Path: /docs/tour/types/closed/ Preview-Path: /docs/tour/types/defs/ Preview-Path: /docs/tour/types/disjunctions/ Preview-Path: /docs/tour/types/numbers/ Preview-Path: /docs/tour/types/lists/ Preview-Path: /docs/tour/types/stringlit/ Preview-Path: /docs/tour/types/stringraw/ Preview-Path: /docs/tour/types/sumstruct/ Preview-Path: /docs/tour/types/templates/ Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com> Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5
See previous commit for context. Page-specific notes: * types: - change plaintext hierarchy diagram to mermaid - include top and bottom - explain "cue eval" as we've avoided it until now * bottom: - change values in the example so they pop more visibly - explain what the example is showing * top: [new page] * numbers: - move some prose into the example's comments - mention number type - align tour with spec: `4` is *not* compatible with `float`. - add examples of float-related sugar - move mention of arbitrary precision into here, from docs/tour/types/bounddef/ * stringlit: - rename to mirror "Bytes" - remove comparison to JSON as it feels out of place - include interpolation in the example * stringraw: - expand example to show comparative versions of the same string with different delimiters * bytes: - plain text table changed to markdown - include mention of how to emit a stringified byte array to help avoid newcomer frustration - example expanded to include the same string being output as a string and as bytes' base64, to show the behaviour more clearly - include string interpolation of bytes to demo "how to display some bytes that you know aren't binary data, as a string" - include multiple examples of both hex and octal escapes, and demonstrate their equivalence via unification * structs: - renamed from /optional; alias added - moved ahead of closed and defs to permit for a more natural flow through learning struct concepts - example is changed from a definition to a regular field, as this page now precedes definitions' page. - updated so it's suitable to accept inbound links that previously targeted the language guide * closed: - updated so it's suitable to accept inbound links that previously targeted the language guide * defs: - updated to be a 90% copy of docs/tour/basics/definitions/, as that content is already written. Examples differ. * disjunctions: - revise awkward wording of first sentence, as it's really jarring until the 3rd or 4th read through - stop explaining the example via the prose; use cue-eval-i instead to demonstrate evaluation failure - expand example's disjunction to include 4 values, so as to demo the syntax beyond just 2 elements * defaults: - add explanation of why defaults exist, what CUE does with a default, and when - reuse "options" language from preceding page - make example abstract - include a 3-way disjunction so it's not implied that the default has to unify with the non-default * sumstruct: - show CUE in action in the example * bounds: - more narrative example, including a multi-constraint field - removed the sentence "The bound is defined for all values for which the corresponding comparison operation is defined", as it feels a little too technical for the tour * bounddef: - move mention of arbitrary precision to docs/tour/types/numbers/ - reword "no unsigned integer type" more positively - use cue vet for examples - make all examples fail * lists: - expand explanation - change example to be more narrative, with less prose required for explanation - begin the examples with common, concrete use cases, so users can get what they need from this longer set of eamples more easily, whilst still demonstrating important syntactic detail nearer the end - include sufficient distinct examples so that the various syntaxes implied by the prose have concrete visualisations - include examples of two failure modes that can confuse newcomers * templates: - mention pattern constraints - expand example to include a disjunction-based pattern constraint, and use top for field instantiation where possible - opened cue-lang/cue#2916 * value-constraints: [new page] - left as draft (i.e. not published) following feedback and awaiting later updates For cue-lang/docs-and-content#78 Preview-Path: /docs/tour/types/types/ Preview-Path: /docs/tour/types/bottom/ Preview-Path: /docs/tour/types/top/ Preview-Path: /docs/tour/types/bounddef/ Preview-Path: /docs/tour/types/bounds/ Preview-Path: /docs/tour/types/bytes/ Preview-Path: /docs/tour/types/defaults/ Preview-Path: /docs/tour/types/structs/ Preview-Path: /docs/tour/types/closed/ Preview-Path: /docs/tour/types/defs/ Preview-Path: /docs/tour/types/disjunctions/ Preview-Path: /docs/tour/types/numbers/ Preview-Path: /docs/tour/types/lists/ Preview-Path: /docs/tour/types/stringlit/ Preview-Path: /docs/tour/types/stringraw/ Preview-Path: /docs/tour/types/sumstruct/ Preview-Path: /docs/tour/types/templates/ Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com> Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5
See previous commit for context. Page-specific notes: * types: - change plaintext hierarchy diagram to mermaid - include top and bottom - explain "cue eval" as we've avoided it until now * bottom: - change values in the example so they pop more visibly - explain what the example is showing * top: [new page] * numbers: - move some prose into the example's comments - mention number type - align tour with spec: `4` is *not* compatible with `float`. - add examples of float-related sugar - move mention of arbitrary precision into here, from docs/tour/types/bounddef/ * stringlit: - rename to mirror "Bytes" - remove comparison to JSON as it feels out of place - include interpolation in the example * stringraw: - expand example to show comparative versions of the same string with different delimiters * bytes: - plain text table changed to markdown - include mention of how to emit a stringified byte array to help avoid newcomer frustration - example expanded to include the same string being output as a string and as bytes' base64, to show the behaviour more clearly - include string interpolation of bytes to demo "how to display some bytes that you know aren't binary data, as a string" - include multiple examples of both hex and octal escapes, and demonstrate their equivalence via unification * structs: - renamed from /optional; alias added - moved ahead of closed and defs to permit for a more natural flow through learning struct concepts - example is changed from a definition to a regular field, as this page now precedes definitions' page. - updated so it's suitable to accept inbound links that previously targeted the language guide * closed: - updated so it's suitable to accept inbound links that previously targeted the language guide * defs: - updated to be a 90% copy of docs/tour/basics/definitions/, as that content is already written. Examples differ. * disjunctions: - revise awkward wording of first sentence, as it's really jarring until the 3rd or 4th read through - stop explaining the example via the prose; use cue-eval-i instead to demonstrate evaluation failure - expand example's disjunction to include 4 values, so as to demo the syntax beyond just 2 elements * defaults: - add explanation of why defaults exist, what CUE does with a default, and when - reuse "options" language from preceding page - make example abstract - include a 3-way disjunction so it's not implied that the default has to unify with the non-default * sumstruct: - show CUE in action in the example * bounds: - more narrative example, including a multi-constraint field - removed the sentence "The bound is defined for all values for which the corresponding comparison operation is defined", as it feels a little too technical for the tour * bounddef: - move mention of arbitrary precision to docs/tour/types/numbers/ - reword "no unsigned integer type" more positively - use cue vet for examples - make all examples fail * lists: - expand explanation - change example to be more narrative, with less prose required for explanation - begin the examples with common, concrete use cases, so users can get what they need from this longer set of eamples more easily, whilst still demonstrating important syntactic detail nearer the end - include sufficient distinct examples so that the various syntaxes implied by the prose have concrete visualisations - include examples of two failure modes that can confuse newcomers * templates: - mention pattern constraints - expand example to include a disjunction-based pattern constraint, and use top for field instantiation where possible - opened cue-lang/cue#2916 * value-constraints: [new page] - left as draft (i.e. not published) following feedback and awaiting later updates For cue-lang/docs-and-content#78 Preview-Path: /docs/tour/types/types/ Preview-Path: /docs/tour/types/bottom/ Preview-Path: /docs/tour/types/top/ Preview-Path: /docs/tour/types/bounddef/ Preview-Path: /docs/tour/types/bounds/ Preview-Path: /docs/tour/types/bytes/ Preview-Path: /docs/tour/types/defaults/ Preview-Path: /docs/tour/types/structs/ Preview-Path: /docs/tour/types/closed/ Preview-Path: /docs/tour/types/defs/ Preview-Path: /docs/tour/types/disjunctions/ Preview-Path: /docs/tour/types/numbers/ Preview-Path: /docs/tour/types/lists/ Preview-Path: /docs/tour/types/stringlit/ Preview-Path: /docs/tour/types/stringraw/ Preview-Path: /docs/tour/types/sumstruct/ Preview-Path: /docs/tour/types/templates/ Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com> Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5 Dispatch-Trailer: {"type":"trybot","CL":1177673,"patchset":41,"ref":"refs/changes/73/1177673/41","targetBranch":"alpha"}
See previous commit for context. Page-specific notes: * types: - change plaintext hierarchy diagram to mermaid - include top and bottom - explain "cue eval" as we've avoided it until now * bottom: - change values in the example so they pop more visibly - explain what the example is showing * top: [new page] * numbers: - move some prose into the example's comments - mention number type - align tour with spec: `4` is *not* compatible with `float`. - add examples of float-related sugar - move mention of arbitrary precision into here, from docs/tour/types/bounddef/ * stringlit: - rename to mirror "Bytes" - remove comparison to JSON as it feels out of place - include interpolation in the example * stringraw: - expand example to show comparative versions of the same string with different delimiters * bytes: - plain text table changed to markdown - include mention of how to emit a stringified byte array to help avoid newcomer frustration - example expanded to include the same string being output as a string and as bytes' base64, to show the behaviour more clearly - include string interpolation of bytes to demo "how to display some bytes that you know aren't binary data, as a string" - include multiple examples of both hex and octal escapes, and demonstrate their equivalence via unification * structs: - renamed from /optional; alias added - moved ahead of closed and defs to permit for a more natural flow through learning struct concepts - example is changed from a definition to a regular field, as this page now precedes definitions' page. - updated so it's suitable to accept inbound links that previously targeted the language guide * closed: - updated so it's suitable to accept inbound links that previously targeted the language guide * defs: - updated to be a 90% copy of docs/tour/basics/definitions/, as that content is already written. Examples differ. * disjunctions: - revise awkward wording of first sentence, as it's really jarring until the 3rd or 4th read through - stop explaining the example via the prose; use cue-eval-i instead to demonstrate evaluation failure - expand example's disjunction to include 4 values, so as to demo the syntax beyond just 2 elements * defaults: - add explanation of why defaults exist, what CUE does with a default, and when - reuse "options" language from preceding page - make example abstract - include a 3-way disjunction so it's not implied that the default has to unify with the non-default * sumstruct: - show CUE in action in the example * bounds: - more narrative example, including a multi-constraint field - removed the sentence "The bound is defined for all values for which the corresponding comparison operation is defined", as it feels a little too technical for the tour * bounddef: - move mention of arbitrary precision to docs/tour/types/numbers/ - reword "no unsigned integer type" more positively - use cue vet for examples - make all examples fail * lists: - expand explanation - change example to be more narrative, with less prose required for explanation - begin the examples with common, concrete use cases, so users can get what they need from this longer set of eamples more easily, whilst still demonstrating important syntactic detail nearer the end - include sufficient distinct examples so that the various syntaxes implied by the prose have concrete visualisations - include examples of two failure modes that can confuse newcomers * templates: - mention pattern constraints - expand example to include a disjunction-based pattern constraint, and use top for field instantiation where possible - opened cue-lang/cue#2916 * value-constraints: [new page] - left as draft (i.e. not published) following feedback and awaiting later updates For cue-lang/docs-and-content#78 Preview-Path: /docs/tour/types/types/ Preview-Path: /docs/tour/types/bottom/ Preview-Path: /docs/tour/types/top/ Preview-Path: /docs/tour/types/bounddef/ Preview-Path: /docs/tour/types/bounds/ Preview-Path: /docs/tour/types/bytes/ Preview-Path: /docs/tour/types/defaults/ Preview-Path: /docs/tour/types/structs/ Preview-Path: /docs/tour/types/closed/ Preview-Path: /docs/tour/types/defs/ Preview-Path: /docs/tour/types/disjunctions/ Preview-Path: /docs/tour/types/numbers/ Preview-Path: /docs/tour/types/lists/ Preview-Path: /docs/tour/types/stringlit/ Preview-Path: /docs/tour/types/stringraw/ Preview-Path: /docs/tour/types/sumstruct/ Preview-Path: /docs/tour/types/templates/ Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com> Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5
See previous commit for context. Page-specific notes: * types: - change plaintext hierarchy diagram to mermaid - include top and bottom - explain "cue eval" as we've avoided it until now * bottom: - change values in the example so they pop more visibly - explain what the example is showing * top: [new page] * numbers: - move some prose into the example's comments - mention number type - align tour with spec: `4` is *not* compatible with `float`. - add examples of float-related sugar - move mention of arbitrary precision into here, from docs/tour/types/bounddef/ * stringlit: - rename to mirror "Bytes" - remove comparison to JSON as it feels out of place - include interpolation in the example * stringraw: - expand example to show comparative versions of the same string with different delimiters * bytes: - plain text table changed to markdown - include mention of how to emit a stringified byte array to help avoid newcomer frustration - example expanded to include the same string being output as a string and as bytes' base64, to show the behaviour more clearly - include string interpolation of bytes to demo "how to display some bytes that you know aren't binary data, as a string" - include multiple examples of both hex and octal escapes, and demonstrate their equivalence via unification * structs: - renamed from /optional; alias added - moved ahead of closed and defs to permit for a more natural flow through learning struct concepts - example is changed from a definition to a regular field, as this page now precedes definitions' page. - updated so it's suitable to accept inbound links that previously targeted the language guide * closed: - updated so it's suitable to accept inbound links that previously targeted the language guide * defs: - updated to be a 90% copy of docs/tour/basics/definitions/, as that content is already written. Examples differ. * disjunctions: - revise awkward wording of first sentence, as it's really jarring until the 3rd or 4th read through - stop explaining the example via the prose; use cue-eval-i instead to demonstrate evaluation failure - expand example's disjunction to include 4 values, so as to demo the syntax beyond just 2 elements * defaults: - add explanation of why defaults exist, what CUE does with a default, and when - reuse "options" language from preceding page - make example abstract - include a 3-way disjunction so it's not implied that the default has to unify with the non-default * sumstruct: - show CUE in action in the example * bounds: - more narrative example, including a multi-constraint field - removed the sentence "The bound is defined for all values for which the corresponding comparison operation is defined", as it feels a little too technical for the tour * bounddef: - move mention of arbitrary precision to docs/tour/types/numbers/ - reword "no unsigned integer type" more positively - use cue vet for examples - make all examples fail * lists: - expand explanation - change example to be more narrative, with less prose required for explanation - begin the examples with common, concrete use cases, so users can get what they need from this longer set of eamples more easily, whilst still demonstrating important syntactic detail nearer the end - include sufficient distinct examples so that the various syntaxes implied by the prose have concrete visualisations - include examples of two failure modes that can confuse newcomers * templates: - mention pattern constraints - expand example to include a disjunction-based pattern constraint, and use top for field instantiation where possible - opened cue-lang/cue#2916 * value-constraints: [new page] - left as draft (i.e. not published) following feedback and awaiting later updates For cue-lang/docs-and-content#78 Preview-Path: /docs/tour/types/types/ Preview-Path: /docs/tour/types/bottom/ Preview-Path: /docs/tour/types/top/ Preview-Path: /docs/tour/types/bounddef/ Preview-Path: /docs/tour/types/bounds/ Preview-Path: /docs/tour/types/bytes/ Preview-Path: /docs/tour/types/defaults/ Preview-Path: /docs/tour/types/structs/ Preview-Path: /docs/tour/types/closed/ Preview-Path: /docs/tour/types/defs/ Preview-Path: /docs/tour/types/disjunctions/ Preview-Path: /docs/tour/types/numbers/ Preview-Path: /docs/tour/types/lists/ Preview-Path: /docs/tour/types/stringlit/ Preview-Path: /docs/tour/types/stringraw/ Preview-Path: /docs/tour/types/sumstruct/ Preview-Path: /docs/tour/types/templates/ Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com> Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5 Dispatch-Trailer: {"type":"trybot","CL":1177673,"patchset":42,"ref":"refs/changes/73/1177673/42","targetBranch":"alpha"}
See previous commit for context. Page-specific notes: * types: - change plaintext hierarchy diagram to mermaid - include top and bottom - explain "cue eval" as we've avoided it until now * bottom: - change values in the example so they pop more visibly - explain what the example is showing * top: [new page] * numbers: - move some prose into the example's comments - mention number type - align tour with spec: `4` is *not* compatible with `float`. - add examples of float-related sugar - move mention of arbitrary precision into here, from docs/tour/types/bounddef/ * stringlit: - rename to mirror "Bytes" - remove comparison to JSON as it feels out of place - include interpolation in the example * stringraw: - expand example to show comparative versions of the same string with different delimiters * bytes: - plain text table changed to markdown - include mention of how to emit a stringified byte array to help avoid newcomer frustration - example expanded to include the same string being output as a string and as bytes' base64, to show the behaviour more clearly - include string interpolation of bytes to demo "how to display some bytes that you know aren't binary data, as a string" - include multiple examples of both hex and octal escapes, and demonstrate their equivalence via unification * structs: - renamed from /optional; alias added - moved ahead of closed and defs to permit for a more natural flow through learning struct concepts - example is changed from a definition to a regular field, as this page now precedes definitions' page. - updated so it's suitable to accept inbound links that previously targeted the language guide * closed: - updated so it's suitable to accept inbound links that previously targeted the language guide * defs: - updated to be a 90% copy of docs/tour/basics/definitions/, as that content is already written. Examples differ. * disjunctions: - revise awkward wording of first sentence, as it's really jarring until the 3rd or 4th read through - stop explaining the example via the prose; use cue-eval-i instead to demonstrate evaluation failure - expand example's disjunction to include 4 values, so as to demo the syntax beyond just 2 elements * defaults: - add explanation of why defaults exist, what CUE does with a default, and when - reuse "options" language from preceding page - make example abstract - include a 3-way disjunction so it's not implied that the default has to unify with the non-default * sumstruct: - show CUE in action in the example * bounds: - more narrative example, including a multi-constraint field - removed the sentence "The bound is defined for all values for which the corresponding comparison operation is defined", as it feels a little too technical for the tour * bounddef: - move mention of arbitrary precision to docs/tour/types/numbers/ - reword "no unsigned integer type" more positively - use cue vet for examples - make all examples fail * lists: - expand explanation - change example to be more narrative, with less prose required for explanation - begin the examples with common, concrete use cases, so users can get what they need from this longer set of eamples more easily, whilst still demonstrating important syntactic detail nearer the end - include sufficient distinct examples so that the various syntaxes implied by the prose have concrete visualisations - include examples of two failure modes that can confuse newcomers * templates: - mention pattern constraints - expand example to include a disjunction-based pattern constraint, and use top for field instantiation where possible - opened cue-lang/cue#2916 * value-constraints: [new page] - left as draft (i.e. not published) following feedback and awaiting later updates For cue-lang/docs-and-content#78 Preview-Path: /docs/tour/types/types/ Preview-Path: /docs/tour/types/bottom/ Preview-Path: /docs/tour/types/top/ Preview-Path: /docs/tour/types/bounddef/ Preview-Path: /docs/tour/types/bounds/ Preview-Path: /docs/tour/types/bytes/ Preview-Path: /docs/tour/types/defaults/ Preview-Path: /docs/tour/types/structs/ Preview-Path: /docs/tour/types/closed/ Preview-Path: /docs/tour/types/defs/ Preview-Path: /docs/tour/types/disjunctions/ Preview-Path: /docs/tour/types/numbers/ Preview-Path: /docs/tour/types/lists/ Preview-Path: /docs/tour/types/stringlit/ Preview-Path: /docs/tour/types/stringraw/ Preview-Path: /docs/tour/types/sumstruct/ Preview-Path: /docs/tour/types/templates/ Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com> Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cuelang.org/+/1177673 TryBot-Result: CUEcueckoo <cueckoo@gmail.com> Reviewed-by: Paul Jolly <paul@myitcv.io>
Noting that the new evaluator gets things right here:
i.e. this passes. |
While here, move the extremely similar regression test from #2916 out of a cmd/cue testscript and into cue/testdata. The txtar tests in cue/testdata are better suited for evaluator tests as they test all evaluator versions, diff between them, and also include other information such as evaluator stats and compiler debugging info. Closes #3157. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: Icdb61cc89178b8236ea9ba8ad42c087a798c66ff Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1200094 Reviewed-by: Matthew Sackman <matthew@cue.works> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org> Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest stable release?
Yes, 0.7.0.
What did you do?
I tried to export the same data as YAML and JSON:
What did you expect to see?
The same data emitted as both JSON and YAML.
What did you see instead?
The text was updated successfully, but these errors were encountered: