v0.3.0-alpha3
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 acmecorpand 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 ofMergeis 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 handlingcmd/cue/cmdmove injection mechanism to cue/loadcmd/cue/cmdverify issue 236 is fixedcmd/cue/cmdverify issue 322 is fixedcmd/cue/cmdverify issue 425 is fixedcmd/cueget go: add --package flagcmd/cueget go: use constant.Value.ExactString to extract constantcmd/helpfix example in doc
cue14
cue/loadadd support for build tagscue/loadadd tool and test files to BuildFiles if requestedcue/loadrelax places where @tag is allowedcue/loadrewrite pre-resolved files after injectioncue/parserallow attributes before package and import clausescueapply wrapping to all errors in listcueclean up handling of preamble declarationscuefix instance error handlingcueimplement fill in terms of Value.Fillcuemake internal cue port main API implementationcuemove to external builtin packagescueprepare to hoist builtin codecueprepare to hoist builtins, step 2cueremove dead code
doc4
doc/ref/spec.mdfix len count for structsdoc/ref/specclarification on cyclesdoc/ref/specconsider definitions for closednessdoc/tutorial/kubernetesremove a duplicate kind field
internal30
internal/core/adtexclude definitions in data conversioninternal/core/adtprevent nil interface bug for Sourceinternal/core/adtremove all closedness IDs in ToDatainternal/core/adtsupport interpolation of bytes and boolinternal/core/compilebetter error message for user-defined errorsinternal/core/evalallow lists resulting from dependent expressionsinternal/core/evalfix empty data vertex buginternal/core/evalfix interpolation of numbersinternal/core/evalfix issue 507internal/core/evalnested comprehension fixinternal/core/evalrewrite of closedness algorithminternal/core/evalverify issue 258 is fixedinternal/core/evalverify issue 293 is fixedinternal/core/evalverify issue 295 is fixedinternal/core/evalverify issue 299 if fixedinternal/core/evalverify issue 306 is fixedinternal/core/evalverify issue 332 is fixedinternal/core/evalverify issue 342 is fixedinternal/core/evalverify issue 353 is fixedinternal/core/evalverify issue 370 is fixedinternal/core/evalverify issue 398 is fixedinternal/core/exportfix bug 473internal/core/exportbetter handling of generated CUEinternal/core/exporthandle scalar values in adt.Vertexinternal/core/exportsuport default pickinginternal/core/exportverify issue 349 is fixedinternal/core/runtimecollect errors for all files in resolveinternal/corefinalize list in sliceinternal/corefix incorrect error handlinginternal/coremove CloseID from Environment to Conjunct
pkg5
pkg/internalcopy cue builtin code to separate packagepkg/mathfix issue 418pkg/tool/file/appendcreate file if none exists.pkg/tool/httpfix handling of errorspkggenerate per-directory tests from builtin_test.go
Other6
alladd missing copyrightallfix four previously ignored errorscidrop go1.12 add go1.15ciname dispatch workflow differently to default branch push workflowdepsupgrade to github.com/rogpeppe/go-internal v1.6.1- update go-internal to pull in fix for Go 1.16
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_f287a8376988dba4142f3797663ea5484ac5409c231e5df81a15c15d09e6a4b0 |
| Linux, Arm64 | cue_28480e7477698b96e32039c8605459c0cf7d0d285a3011ced05e59f3d6a98a1e |
| Linux, x86-64 | cue_3b6f875ca03a777086e3eed2faff058cc4485ca6d23571812a92de6f385055b6 |
| Windows, x86-64 | cue_577026105bfc107f09ee6592f94aff095050e344498b9aaa2744932f64310783 |
SHA-256 checksums for all of these: checksums.txt