Cue

Cue·CueLang.Cue

CUE is an open source data constraint language which aims to simplify tasks involving defining and using data.

winget install --id CueLang.Cue --exact --source winget

Latest 0.18.0·November 24, 2026

Release Notes

The new cue.dev is live! Starting with v0.18, CUE Labs builds, signs and publishes CUE there, with v0.18 as our first long-term support release. For companies that depend on CUE, we're also introducing CUE Enterprise.

https://cue.dev/blog/the-cue-labs-distribution/


Changes which may break some users are marked below with::warning:

Language

As a reminder, the try experiment and the shortcircuit experiment introduced in v0.17.0 are both still ongoing. Please give them a try and report any issues or feedback!

:warning:Strict embedding and the ... operator

The explicitopen experiment, ongoing since v0.15.0, is now stable:from language version v0.18.0 on, embedding is strict and needs no opt-in. A struct which embeds a closed value is now closed to that value's fields, where before the embedding constrained only itself and left its sibling fields alone, and a comprehension's conjunct closes its struct just like any other conjunct. The new postfix ... operator opens an embedded value again, so #A... embeds #A without closing the struct around it.

#A:{a: int}

x:{
	#A     // x is now closed to #A's fields
	b:1   // error: field not allowed
}
y:{
	#A...  // spread leaves y open
	b:1
}

Migrate a module with cue mod upgrade, described below, or by running cue fix --exp=explicitopen while it is still at an older language version and only then raising language.version in cue.mod/module.cue:a file at v0.18.0 or later has no way back, as an @experiment attribute can only enable an experiment. See the how-to guide and the proposal for the full design.

:warning:Postfix aliases and self

The aliasv2 experiment, also ongoing since v0.15.0, is now stable:from language version v0.18.0 on, the postfix alias syntax and the predeclared self identifier need no opt-in, and the old prefix syntax is no longer accepted.

x~(X):         {a: 1, b: X.a} // was x: X={a: 1, b: X.a}
[string]~(K,_):{name: K}      // was [K=string]: {name: K}

// A value alias becomes a let binding on self.
y:{
	let Y = self
	c:2
	d:Y.c // was y: Y={c: 2, d: Y.c}
}

As above, cue mod upgrade or cue fix --exp=aliasv2 rewrites the prefix form; cue fix --exp=explicitopen,aliasv2 applies both migrations in one pass. See the how-to guide and the proposal.

The new functions experiment

The new functions experiment adds function literals, function types, and calls to the language. A function literal declares its parameters, may constrain its result with ->, and defines its body after the final :; a call supplies arguments by position or by label. Functions are values:they unify with themselves and with function types, they capture the scope they are declared in, and they may be applied partially.

You can try this experiment on a module at language version v0.18.0 via the @experiment(functions) file attribute:

@experiment(functions)

add:  func(a: int, b: int) -> int: a + b
scale:func(x: int) -> int: x * 2
out:  add(1, scale(3)) // 7

A literal without a body denotes a function type, which constrains a function value in the same way a schema constrains a struct:an implementation unified with a function type must accept every argument the type admits, and callbacks are checked where they are passed. Function types match parameters by label, combining optional, required, and regular parameters as for struct fields. Recursion via closures, such as with a fixed-point combinator, is detected as a structural cycle (#4495). See the proposal discussion and its revision on function contracts for the full design.

The new openlists experiment

The new openlists experiment makes lists open by default, just like structs. A list literal without a trailing ellipsis is no longer fixed to its length outside of definitions, so unifying [3] with [_, 4] yields [3, 4] rather than an incompatible list lengths error. Lists close where structs close:within a definition, or when passed to close, which now accepts lists as well as structs.

The experiment also introduces closed literals:#[1, 2] means what [1, 2] means without the experiment, and #{a: 1} closes a struct at its own level as close does. As #[ now starts a closed list, an index on a definition named # is written (#)[i].

You can try this experiment on a module at language version v0.18.0 via the @experiment(openlists) file attribute. cue fix --exp=openlists rewrites existing files so they keep their meaning, writing list literals as closed literals and wrapping slices and builtin results in close. See the proposal for the full design.

:warning:Exact arithmetic

Integer addition, subtraction, and multiplication are now exact at any size, as the spec requires, rather than rounding to 34 digits. This also fixes strconv.FormatInt and uuid.FromInt failing on large integers (#3787, #4263), as well as SI multipliers on long literals, math.Floor, math.Ceil, and math.MultipleOf, which all rounded numbers beyond 34 digits.

Dividing two integers now yields an int when the quotient is exact, as the spec has always prescribed:4 / 2 is the integer 2, so x: float & 10 / 5 is now a conflict. A quotient also keeps the decimal places its operands imply, so 6.00 / 3 is 2.00, and an exported float always carries a digit after its decimal point.

The list.Sum, list.Product, list.Avg, list.Range, list.Min, list.Max, math.Abs, math.Copysign, and math.Dim functions now follow the arithmetic operators, keeping the kinds of their arguments:list.Sum([1.5, 2.5]) is now the float 4.0 rather than the integer 4, so a field declared int no longer accepts it.

Other changes

A CUE file which belongs to no module can now declare the language version it is written for with a @version attribute, placed ahead of any other file attribute and the package clause, so that a reproducer or a standalone file written for an older version runs as written without creating a module for it. The attribute is an error in a file of a module which declares a language version, as the module file decides the version of its files.

@version(v0.17.0)

package p

File attributes such as @experiment(...) and @extern(embed) are now honored between the package clause and the import declarations, where the spec allows them, rather than being silently ignored or rejected (#2371).

:warning:Pattern constraints may no longer be marked as optional or required: [string]?: int and [string]!: int are now rejected by the parser, matching the spec grammar. A pattern constraint is optional by construction, so the markers had no effect; simply remove them (#3716).

The comparison bounds == and != now work with boolean values, so constraints like !=true behave as documented in the spec (#4388). Multi-line strings now accept a backslash-escaped newline (#2317), and for k, k in x is rejected as a redeclaration (#4012).

Evaluator

:warning:Closedness

Selecting through a regular field which holds a definition now keeps the definition's closedness, just like selecting from the definition itself. Such selections inside a for comprehension's body are now closed as well, as they already were inside an if.

#D:s: {a: 1}
d:#D
x:#D.s & {extra: 1} // error: field not allowed
y:d.s & {extra: 1}  // now also an error

This most often shows up when a comprehension iterates over a definition and the values it yields are then extended with further fields, for example by a pattern constraint. If those values are meant as data to build on, declare them as a regular or hidden field instead of a definition, or leave the struct open with ....

Closedness also follows what a reference denotes rather than where it is evaluated. A reference which reaches into a definition from outside now closes the value it selects even when it is evaluated inside that definition, such as outside.s below, which was previously accepted. Conversely, a definition which refers to a regular struct no longer rejects a field which a sibling reference in that struct supplies (#4501).

outside:#Out
let Out = {s:{a: 1}, u: outside.s & {b: 2}} // error: field not allowed
#Out:Out

#P:{a?: int}
x:{q: {}, s: #P & q & {a: 3}}
#L:{v: x} // no longer rejects a

As the spec requires, an ellipsis in an embedding, as in s:{{#B, ...}, h: {i: 1}}, now opens only the struct it is part of, and no longer the structs declared beside the embedding, so that a field added to one of them, such as s: h: extra: 1, is rejected as field not allowed. Give such a struct its own ellipsis, as in h: {i: 1, ...}, or declare the field in it. Fields opened by the spread operator are also closed again in more cases, as the spec requires (#4525, [#4528](https://cuelang.org/i

Installer type: zip

x64—C2B17FC673B1395704CF4DB657327C5F9DA831EDAB5164531EC315BA05BB95B4
arm64—77E3EC0CB46BFBBF76967BD1BBDB94769084DDF489D77504F0C6A26E51D5AC82

Details

Homepage
https://github.com/cue-lang/cue
License
Apache-2.0
Publisher
Cue
Support
https://github.com/cue-lang/cue/issues

Tags

configurationdatakubernetesvalidation

Older versions (20)

0.17.1
x64—9F15378DC52B9A1BB6FA1755ADC0410C9F17F330A621B784A5B31FDBC91C6D7A
arm64—DB88B2C302BE1829E653E20EA87E3F1ADC10AE2052D58FE87D21D0ED97102E51
0.17.0
x64—5EE7C2A1AD13B8ED7521B164532E48C8BC1618B500AC3C5808CBBD47D4C9CCB8
arm64—CEFCFC8AAD2CD6374512F45975FB8CD0DC69DCB6E3C2CA2022E2E1761F5FB858
0.16.1
x64—2F24123F458229FCF283DB534BD86692AD1074DA806DEFEE0F0CC62976C0397C
arm64—E0C15CE53F73E8609B0E8CE6507298F3474B334AC5EB0C826C9497A811FD0CCE
0.16.0
x64—E57180A908A5E35D8A2BE00BA620B52FC6FDFC6E1400799D25BB53A115555B03
arm64—E0BD483BE9159144C1ED2A19EE722A1FC6EE18BFDE173AFE02637F0AF8DA501E
0.15.4
x64—D42E26A0FB09219FC1735326FB2188DADF7C8DEAB136698A55D793C0C15A6AAA
arm64—A19CE1F517879B1BB3F5CB815364A2EC74B0302B54A86F5802A2C56AE3B7BA97
0.15.3
x64—D291BD510887BF1308A6BC07C28D17C7F01BC75E7A885ADACDBD30D6D6ECBD20
arm64—F7B72102BCF227800276BFB22D0D16CFCDAECEB79A1E99AF492AAA3EEA6BB839
0.15.1
x64—516FA080C1AF12578FF76A4165CC7BF14AD9BBE5D9724A0C07553860D038885E
arm64—BF789490A4C9B1FE2AEC8B1B078FB5CDD428C4653FAE1A0572CB75C1ADE50CA7
0.15.0
x64—188931801FF39CD397589A7A271EDE54EF0694900CA3F06BC9834DDDBB3F39AE
arm64—A47D356E4AD3CD891DF55C28C24763193F4973662BE9CCC4704090083D89FF34
0.14.2
x64—0A1C6A050494D2D8D671E15967D2D2AB2BD37DCE48E193E59728242797C86BB0
arm64—2187A7909951BFF30DD621DDE368CDEEBC30DC5FCF8D93F2F9C3DDC558AECA1D
0.14.1
x64—B2289FEB775DB9D10DE6C039FFECCC8AFB7A7FE0C656AF891F8FCE7F38AA1D8A
arm64—3BA4B950B1880AEC6F3DDD5D96F43648E4E0FF58151FFC17375068EF9EBF361A
0.14.0
x64—9041F014820924E4FDE7BB2C295F4DA63E9AD6590F92D73E6C4BC37ABE5F2077
arm64—045878CF337143B54CCAFF2718C4DD2431922AD53182A17D088E7A3D731B032B
0.13.2
x64—9C5513C5BBAE3AAB5B906611E8E487A999BFB69851ED3267D4FF3C488269C271
arm64—B97AC155F753FF58633EC50985FF5BA90C719A5F1FBC59EA2B84E6CE2C026555
0.13.1
x64—934F10F81E3FEA059594029C84FD0AE49C4D746F463654DAF4A06C10B0A369B0
arm64—4D6DF90A83E6BE1EF8EEF997877DF6BCAFB9B97763A303B962D2815B92560516
0.13.0
x64—A17423528E176F984AE4778FE5C757955783985913A8E18D6CCC663EAF91C279
arm64—FEF57DF2265C9CE92426EA698C9BF38E053F6B579A5F7CF1B8963926252AAC00
0.12.1
x64—A80B570BD5D2D7D7E653F3C8689B37A7396A98D486901A14954F1EF6A83BD275
arm64—61563BF81F0020BF7B6DD7F69B981F0E77DD0A014B17323905236623CA3CA705
0.12.0
x64—268BF95F4767B37D5DB01450D55CA9D10E9A8BD8A1417C31DFF456B5F9775ABF
arm64—91AD090EB86B0D21186D8DE0A7B985D235B27E67CD464F7738663E457B042505
0.8.0
x64—8E3CED001982F10581DC1A6EEB82E08ADEE1B1E2ABE5B7E837A35401895C6BA7
arm64—F5E5D9D3C7D0649D16AFDBC21BDE51EBC558FE64AC51AE89085037363DD658FC
0.7.1
x64—54D2A7F64985BB5F4BDBFF8796EE9F290BA7C86BA1D8B98822373D01EBFAE19A
arm64—4583FC57B6E90DA51F2397D0C9E65912D18A4DC4A6C946EA4347AF91BD9C7F38
0.7.0
x64—50BE1C1A622C2544AE834B377293A587A0C08B3EA6C82441AE1D59435EEB5240
arm64—257AB9A0A2723B84CB24F8F6AE7A9F899EBDE49B81371EF9EE1EC34FACFA2CCD
0.6.0
x64—69C32671349665EC4AF9B8AB7A312E870B8318BF747041C0DA2B8F505CE0E2E5
arm64—C8BA01B8914DA74BEDBCA653846C0311DCC2ED07FDB83BEBACC59BA0F72C3F7E