github cue-lang/cue v0.16.0-rc.1

pre-release6 hours ago

Changes which may break some users are marked below with: ⚠️

Language

As a reminder, we have two ongoing language experiments since v0.15; a replacement for struct embedding and a rework of aliases. Please give these a try and report any issues or feedback!

⚠️ else is now part of the try experiment

v0.16.0-alpha.2 introduced the else comprehension clause, available to any module targetting language version v0.16.0 or later without needing to use an experiment.

Thanks to user feedback and design discussions, we have come to realize that the existing design needed tweaking. for comprehensions now use a fallback token rather than else in order to clarify intent, and we have also restricted the use of else in chains of comprehension clauses, which could easily cause confusion.

Given how late in the release cycle we already are, and understanding that we probably will want to make further tweaks to this feature before it's stable, we have decided to put this language feature behind a file experiment after all.

Rather than adding @experiment(else), we have chosen to bundle this with @experiment(try), given that try without else does not make much sense.

For more information on the up-to-date else and fallback clauses, follow our how-to guide, or read the updated spec change patch.

Evaluator

Fix a regression introduced by v0.16.0-alpha.2 where cue cmd could suddenly report undefined or missing fields from data in non-tool CUE files.

cmd/cue

cue exp writefs gains an encoding optional field for regular files, to specify an encoding rather than infer it from the filename extension.

Full list of changes since v0.16.0-alpha.2
  • lsp/eval: add support for comprehension else/fallback by @cuematthew in e2d8f7b
  • cmd/cue: support explicit encodings in exp writefs by @mvdan in d0eca3f
  • cmd/cue: rewrite exp writefs with internal/filetypes and internal/encoding by @mvdan in 766668d
  • cmd/cue: add first exp writefs testscript by @mvdan in 00eddbf
  • internal/core/adt: missed missing missing by @mpvl in 8732213
  • cue/parser: simplify else/fallback clause rules by @mpvl in 0cbc9a1
  • cue/parser: restrict else to single clause only by @mpvl in 28f0246
  • cue: add fallback keyword for for comprehensions by @mpvl in fe9f503
  • cue/testdata: rename out/eval to out/evalalpha when appropriate by @rogpeppe in c76dc5a
  • cue/build: fix stale identifier resolution across instances by @mvdan in dd7361a
  • cmd/cue: add regression test for issue 4275 by @mvdan in 791e697
  • encoding/yaml: improve ast.StructLit and ListLit positions by @cuematthew in cde471e
  • cmd/cue: be more helpful when publishing a module without source by @mvdan in 3dfa50a
  • encoding/jsonschema: remove net/url.Parse workaround for Go 1.26 by @mvdan in 6cce9bc

Don't miss a new cue release

NewReleases is sending notifications on new releases.