v0.3.0-alpha3

cue-lang/cue Pre-release Released

A release of CUE OSS · its page on GitHub

This release mainly introduces per-file inclusion based on tags, bug fixes for bugs introduced in the new evaluator, and tests to close issues raised on the old evaluator that are now verified to be fixed.

Language extensions

Attribute declarations in preamble

Attribute declarations are now allowed before the package clause and import declarations. This is used to implement file-wide inclusion.

Any scalar now allowed in interpolations

This includes boolean and byte values. Boolean values are represented as their JSON value. In string interpolations, bytes are converted to valid UTF-8 by replacing the maximal subpart of ill-formed subsequences with a single replacement character (W3C encoding standard).

Whole file inclusion

CUE now allows files to be conditionally included in a build. To conditionally include a file in a CUE program, one can now write:

@if(prod)

package acmecorp

and use the -t prod flag to cause this file to be included. The expression can be any valid CUE expression using only boolean operators and boolean values.

See cue help injection for more details.

Closedness rewrite

A large number of bug fixes related to an incorrect “field not allowed” error are now in. The algorithm for closedness has been significantly simplified and streamlined based on the benefit of hindsight.

Note that one may still have a misleading “field not allowed” error if a field is disallowed in one disjunct and allowed in another, but where there is another field in conflict. Right now only one of the errors is reported.

CUE API

New evaluator

The CUE API is now moved to the new evaluator.

Package dependencies

Builtins now live in their own package and are no longer copied into the cue API. This was part of the effort to break the implementation into logical pieces, instead of having one large package.

This has the additional advantage that each builtin package now only lives in its own directory and is not copied. This makes maintenance easier and also removes some of the limitations imposed by the old implementation.

Unfortunately, this means that custom loader implementations (ones that do not use cue/load for loading packages) will have to include

import 	_ "cuelang.org/go/pkg"

somewhere in the package to trigger linking in the builtin packages.

cue tool

This release also marks the first steps of moving functionality from the cue command line tool to the CUE APIs. The intention is that the cue tool will be mostly a wrapper around core functionality present in the API. Other tooling could provide a different “view” without being second-class citizens in the ecosystem and while providing consistency between such tools.

The first step towards this is the injection mechanism. The existing parts of this were moved to the cue/load package. The new file inclusion functionality, meanwhile, was directly implemented in cue/load.

The next step will be to move non-CUE file support and packaging mechanisms to cue/load and friends. Then next up is the tooling layer, starting with an API for dependency analysis.

Next steps

There are two outstanding issues on the table to come to a beta release:

Disjunctions

Although there are no known semantic bugs related to disjunctions, the code needs some restructuring to improve error messages and to fix some performance issues. This is slated for the alpha4 release.

Structural cycles

There are still some bugs outstanding related to structural cycles. The plan is to address all of these in an alpha5 (or possibly beta) release.

Backwards compatibility

Go version

Support for go1.12 was dropped. In exchange, this release is verified to build with Go’s tip (1.16).

CUE API

The CUE API has now fully been moved over to use the new evaluator. The old evaluator code has been removed.

  • cue.Merge: the purpose of Merge is to unify the underlying instances as data. It now no longer also unifies definitions. Bug fixes in closedness exposed this previously unnoticed oversight.

Custom loader implementations (ones that do not use cue/load for loading packages) will have to include

import 	_ "cuelang.org/go/pkg"

somewhere in the package to trigger linking in the builtin packages.

Language changes

CUE code that previously expected a boolean or bytes value substituted in a string interpolation to fail my now break.

cue cmd

Commands that operate on multiple instances simultaneously (e.g. cue cmd foo ./...) can no longer reference definitions in the underlying commands. For more info see cue.Merge in the API section.

All changes

67 changesby area

cmd8

  • cmd/cue/cmdfix get go package handling1c54297
  • cmd/cue/cmdmove injection mechanism to cue/load1e8906a
  • cmd/cue/cmdverify issue 236 is fixedfaf617c
  • cmd/cue/cmdverify issue 322 is fixede71970c
  • cmd/cue/cmdverify issue 425 is fixed8776561
  • cmd/cueget go: add --package flagba5708b
  • cmd/cueget go: use constant.Value.ExactString to extract constant1a9b88d
  • cmd/helpfix example in docf25c04d

cue14

  • cue/loadadd support for build tags089f461
  • cue/loadadd tool and test files to BuildFiles if requestedbc101b3
  • cue/loadrelax places where @tag is allowed20c637a
  • cue/loadrewrite pre-resolved files after injectionbd3dd75
  • cue/parserallow attributes before package and import clausesc264475
  • cueapply wrapping to all errors in list4cce6c4
  • cueclean up handling of preamble declarationsd2fdbf0
  • cuefix instance error handling80e70b9
  • cueimplement fill in terms of Value.Fillc76a530
  • cuemake internal cue port main API implementation845df05
  • cuemove to external builtin packagesabce145
  • cueprepare to hoist builtin codece28b20
  • cueprepare to hoist builtins, step 29acd624
  • cueremove dead code40a6bcd

doc4

  • doc/ref/spec.mdfix len count for structsedea6f3
  • doc/ref/specclarification on cycles043c534
  • doc/ref/specconsider definitions for closednessdd0fa88
  • doc/tutorial/kubernetesremove a duplicate kind fieldc7c14fd

internal30

  • internal/core/adtexclude definitions in data conversione3a03a1
  • internal/core/adtprevent nil interface bug for Sourcedb18b37
  • internal/core/adtremove all closedness IDs in ToDataf5fa009
  • internal/core/adtsupport interpolation of bytes and bool30ca062
  • internal/core/compilebetter error message for user-defined errorsdf01042
  • internal/core/evalallow lists resulting from dependent expressionsd55e2b5
  • internal/core/evalfix empty data vertex bugc72ce5d
  • internal/core/evalfix interpolation of numbers0b57e43
  • internal/core/evalfix issue 507e0c19d1
  • internal/core/evalnested comprehension fix304b02e
  • internal/core/evalrewrite of closedness algorithm62528c3
  • internal/core/evalverify issue 258 is fixeddc2401c
  • internal/core/evalverify issue 293 is fixedddd99d5
  • internal/core/evalverify issue 295 is fixedea5d964
  • internal/core/evalverify issue 299 if fixed480e1a1
  • internal/core/evalverify issue 306 is fixed541bf03
  • internal/core/evalverify issue 332 is fixed5905c22
  • internal/core/evalverify issue 342 is fixed121ace7
  • internal/core/evalverify issue 353 is fixed07ce2f6
  • internal/core/evalverify issue 370 is fixed4ecec98
  • internal/core/evalverify issue 398 is fixedfbf9de3
  • internal/core/exportfix bug 473c6ade67
  • internal/core/exportbetter handling of generated CUEb9b2c54
  • internal/core/exporthandle scalar values in adt.Vertex1e1fe6f
  • internal/core/exportsuport default picking67d1d42
  • internal/core/exportverify issue 349 is fixeddf9468e
  • internal/core/runtimecollect errors for all files in resolve60c207f
  • internal/corefinalize list in slicea6ce869
  • internal/corefix incorrect error handling148f67a
  • internal/coremove CloseID from Environment to Conjunct3d863fc

pkg5

  • pkg/internalcopy cue builtin code to separate packagebf882b0
  • pkg/mathfix issue 418dda7de4
  • pkg/tool/file/appendcreate file if none exists.4f4b7a3
  • pkg/tool/httpfix handling of errorsc8a4514
  • pkggenerate per-directory tests from builtin_test.go248794e

Other6

  • alladd missing copyrightd69319c
  • allfix four previously ignored errors4c10692
  • cidrop go1.12 add go1.156c27cef
  • ciname dispatch workflow differently to default branch push workflowc3f30d8
  • depsupgrade to github.com/rogpeppe/go-internal v1.6.16f84d11
  • update go-internal to pull in fix for Go 1.161bcb73a

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-alpha3_Darwin_x86_64.tar.gzf287a8376988dba4142f3797663ea5484ac5409c231e5df81a15c15d09e6a4b0
Linux, Arm64cue_0.3.0-alpha3_Linux_arm64.tar.gz28480e7477698b96e32039c8605459c0cf7d0d285a3011ced05e59f3d6a98a1e
Linux, x86-64cue_0.3.0-alpha3_Linux_x86_64.tar.gz3b6f875ca03a777086e3eed2faff058cc4485ca6d23571812a92de6f385055b6
Windows, x86-64cue_0.3.0-alpha3_Windows_x86_64.zip577026105bfc107f09ee6592f94aff095050e344498b9aaa2744932f64310783

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

Install CUE