v0.3.0-alpha4
This is a relatively small release. But given that it contains some significant bug fixes and performance improvements, it seemed useful to get these out sooner.
This also
Closedness refinements
The rules surrounding closedness have been further clarified in the spec where this was previously ambiguous. Most notably, it was previously unclear whether B.b in
#A: {a: int}
B: {
#A
b: c: int
}should be closed or not. This is now clarified to it not being closed. In other words, fields added alongside an embedded definition that were not part of the original embedding are not closed automatically.
This does not change the current behaviour.
There was also a bug fix related to closing structs that could leave struct open if they were referenced through a selector path like #A.b, where the reference to #A failed to trigger a close.
There remains one known gap in the implementations compared to the spec: embedding a closed struct will currently cause the field to be closed, whereas the spec says that the struct in which it is included should already be closed. This will be a backwards-incompatible change.
field not allowed error
As far as is known, aside from the spec deviation mentioned above (which is somewhat esoteric), there are no more known deviations that result in a spurious error of this kind.
There is, however, one known case where this error seems to appear erroneously. Consider the following:
#a: {b: int} | {}
b: #a & {b: string}This may still result in a “field b not allowed” error. The problem is that the error reporting around disjunctions is still lacking. What happens is that only the error of one of the failed disjuncts is reported. In this case it fails on the first disjunct (as int != string) and the subsequently fails on the second, which doesn’t allow b. As only one of the errors is reported, it may appear that it fails on the first disjunct, which is just confusing.
The intention is to considerably improve disjunction errors soon. In the meantime, the added position information for conflict errors will hopefully help a hand to disambiguate such errors.
let clauses are now allowed in comprehensions
This has been a part of the spec for a long time, but now has finally been implemented.
... anywhere in struct
This was already allowed by the spec, compiler, and evaluator, but now is also allowed by the parser.
Simple string literals now allowed as selector
Another thing that has been allowed by the spec for a while is the use of string literals as selectors. So a.”foo”.bar is now allowed. Only single-line strings without interpolations are allowed at the moment (as per the spec).
Command line tool
cli.Ask
This is now supported.
Error reporting
Error reporting has been improved further. Most notably, positions for conflict errors (as resulting from 3 & 4), now have positions added and should be on par with v0.2.2. This also adds the fundamentals for adding richer position notation.
Performance
This release fixes one big performance issue, which could lead to exponential runtime for disjunctions. This can have a big impact for many configurations. For one user, it reduced the running time from 5 hours to less than 2 seconds.
As part of this fix, we now introduced a benchmark suite.
There are tons of significant performance improvements still possible, so this is not the last of it.
Notable Bug fixes
String handling
CUE used to piggyback on Gos strconv.Quote` for quoting strings. This was not ideal, as CUE and Go strings are not the same. It also resulted in some bugs. This is now fixed. This results in better string formatting overall.
Handling of files named -
The cue command line tool sometimes hung when a directory contained a file named -. This is now handled.
Yaml version
Until now, CUE would output YAML in version 1.2 and read it in version 1.1. And it seems that the “right thing to do” is to implement version 1.2 these days. This has now provisionally been fixed to read it mostly as version 1.2. A more proper implementation would be to replace internal/third_party/yaml to use the yaml.v3 package.
This means, for instance, that the value no is now treated as a string instead of the boolean value false. (And thus the demo on cuelang.org will have to be replaced.)
Message-level options in Protobuf
Handling of message options in .proto files would previously fail. They are now translated into declaration options in CUE with the format: @protobuf(option name=value).
Backwards compatibility
YAML
As YAML 1.2 is not backwards compatible with YAML 1.1, inputs to CUE that relied on a YAML 1.1 interpretation may now yield different results.
Closedness rules
The refinement of the rules of closedness are largely backwards compatible (and what is not is not yet implemented), but some of the bug fixes may give slightly different results nonetheless.
All changes
23 changesby area
cue7
cue/formatindent multiline string literals based on context.cue/literalimplement CUE-specific quotingcue/loaddon't hang on files named -cue/parserallow ... anywhere in structcue/parserallow let clause in comprehensioncue/parserbetter error message for old-style definitionscue/parsersupport string selector labels
doc4
doc/ref/spec.mdfix builtin funcdoc/ref/spec.mdfix spec bug and broken linkdoc/ref/spec.mdrefinement of closednessdoc/tutorial/kubernetesupdate import
internal9
internal/core/compilefix alias resolution buginternal/core/compilefix hidden definition buginternal/core/eval... does not apply to defintionsinternal/core/evaladd more positions to conflict errorsinternal/core/evalcheck for nil pointerinternal/core/evalfully evaluate nested unificationinternal/core/evalperformance: unify an arc only once per nodeinternal/core/evalsimplify validators upon evaluatorinternal/third_party/yamldrop support for non-standard scalars
Other3
Readme.mdremove Go Report Cardencoding/protobufparse message optionspkg/tool/clisupport ask task
Downloads
Every file this release published on GitHub, with its SHA-256. Most people install CUE as Installing CUE describes, which also shows how to check a download.
Archives
| Platform | File and SHA-256 |
|---|---|
| macOS, Intel | cue_659912f149bb1534c2e72baae31e3d4de108b292af3907f402d25fa101f80d98 |
| Linux, Arm64 | cue_7a7c7187bcdc8f6395ea9efda8253208343ebeb85e078b34606acebaab20784b |
| Linux, x86-64 | cue_ba54e55d91ffc430fdb83116b2bf4b0e284083396e5ca63af3fad742c2920da5 |
| Windows, x86-64 | cue_820b581e7285b78644d4bcfd1a0bd2c9f2153ddc4880c501a7423ab7992dc778 |
SHA-256 checksums for all of these: checksums.txt