v0.3.0-beta.5

cue-lang/cue Pre-release Released

A release of CUE OSS · its page on GitHub

This release has some important bug fixes. It also is a bit stricter in considering some errors that were previously evaluation-time errors to be compile time errors.

There is also a slight change in default handling, which should not affect most configurations.

New compile-time errors

The expression >10 <20 is syntactically valid CUE, but can never meaningfully evaluate to something. It parses as >(10 < 20) and thus evaluates to >true, which is undefined. The error messages associated with this were often confusing to the user. Also, leaving this to be detected during runtime would sometimes hide the error away.

Consistent with the “fail early” mantra, these cases are now detected and reported by the compiler.

Backwards compatibility

Defaults

Previously, for

#def: {
   *{} | {a: int} | {b: int}
   *{} | {c: int} | {d: int}
}
x: #def & {a: int}

would officially resolve to

x: {a: int} | {a: int, c: int} | {a: int, d: int}

Thanks to a hack in the current v0.3 implementation, the first disjunct was made the default and all resolved fine. We have now slightly changed the definition of defaults to handle this case. Basically, now if during a unification all terms of a disjunction that are marked as default are eliminated, the remaining terms will behave as if they originated from an unmarked disjunction. In practice this means defaults behave as users typically expect them to behave. This may also cover cases that were not previously handed

Note that v0.2 solved things differently: if in the result of a disjunction one term subsumes another, then the latter could be dropped. So in v0.2, the answer would be x: {a: int}, even in the absence of defaults. The problem with this approach is that it could lead to confusing answers and that the default could not always be accurately determined. A goal of v0.3 was to have a simpler story for disambiguation and let simplifications be merely a matter of optimization.

There is still a slight discrepancy in the current implementation and the spec that may cause unexpected results. We expect this to be sufficiently rare and we intend to address this in a rework of disjunction computation, aimed at further performance optimizations.

All changes

19 changesby area

doc3

  • doc/ref/spec.mdadd missing binary_digits500e431
  • doc/tutorialaddress cuelang/cuelang.org#12689cada6
  • docfix install instructions in main README and contributing77b475f

internal11

  • internal/core/adtcomment out leak test25ba1d9
  • internal/core/adtcontrol fixes for if clausesb25147c
  • internal/core/adtfix trim bug267379b
  • internal/core/adtsome optimizations for pattern constraints48d255a
  • internal/core/adtstrip "notDefault" status for disjunctions with unused defaults87d43b7
  • internal/core/compilemake >10 <20 a compile error760aa11
  • internal/core/convertfix conversion from floatb20ac5a
  • internal/core/evalhandle embedded top correctlybcd752a
  • internal/core/exportfix quoting of definitionsa5daa16
  • internal/cuetestconsolidate testscript/cuetxtar helperscb4fae9
  • internal/cuetestmove Kubernetes related helper to where they are usedbf6c3fc

tools3

Other2

  • cimove to non-Docker version of goreleaser1b03c9f
  • ciskip known flakey test on go1.15 windowsae51469

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

PlatformFile and SHA-256
macOS, Intelcue_0.3.0-beta.5_Darwin_x86_64.tar.gzaef41df71c1507795d090f809afb4cdcbef6365e0bcbe4f7779d0d54afaec39c
Linux, Arm64cue_0.3.0-beta.5_Linux_arm64.tar.gz140f130f677037fc5daef5c23d2c74e207be963bb775bfedaf4ab5e2ad02862d
Linux, x86-64cue_0.3.0-beta.5_Linux_x86_64.tar.gzf1ccf4fae2079ecb825e7bf9694f053088a3651c92c1399fdaa0a8d8104f47d5
Windows, x86-64cue_0.3.0-beta.5_Windows_x86_64.zip5063c681e5b097c30d5b482975cbf4ef9e73251738bf2690049c616ee596d798

SHA-256 checksums for all of these: checksums.txt

Install CUE