Skip to content

Commit

Permalink
docs/concept: new FAQ: list arithmetic ops removal
Browse files Browse the repository at this point in the history
This adds an FAQ guide that explains the removal of list arithmetic
operators ("+" and "*") from CUE v0.11 and later.

Closes cue-lang/docs-and-content#178

Preview-Path: /docs/concept/faq/removing-list-arithmetic-operators-v0.11/
Signed-off-by: Jonathan Matthews <[email protected]>
Change-Id: I8d50c273ccedb7cf6ca5295917032d5aa822b413
Dispatch-Trailer: {"type":"trybot","CL":1200357,"patchset":3,"ref":"refs/changes/57/1200357/3","targetBranch":"master"}
  • Loading branch information
jpluscplusm authored and cueckoo committed Aug 30, 2024
1 parent 6ccc4f0 commit ee797d4
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: Removing list arithmetic operators in CUE v0.11
authors: [jpluscplusm]
toc_hide: true
---

In early versions, the CUE language explicitly allowed arithmetic operators
("`+`" and "`*`") to take list arguments.
This feature was removed from the language specification
[several years ago](https://review.gerrithub.io/plugins/gitiles/cue-lang/cue/+/172f0060cd405f30c5873b793e44300e1a3588cb%5E%21/),
and its removal is now being completed in CUE version `v0.11`.
This FAQ answers some of your questions about what's changed.

## What's being removed, and from where?

TODO(jcm): The operators `*` and `+` when used with list arguments will stop
working with the CUE evaluator in the `cue` command, and the CUE Go API.

## Why were list arithmetic operators supported until now?

TODO(jcm): Because folks might have had CUE that used this syntax, but enough
time has now passed without it being mentioned on cuelang.org or the CUE
language spec that we can assume it's not being used by anyone.

## What's the replacement for list arithmetic operators?

TODO(jcm): list.Repeat(), list.Concat(), and nested for loops. Show examples.

## Which version of CUE removes list arithmetic operators?

TODO(jcm): any version that starts `v0.11`.

## Am I affected?

TODO(jcm): probably not. FIXME: how to check?

## I *am* affected! How can I fix my CUE?

TODO(jcm): `cue fix` examples. Manual fixup examples.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package site

content: docs: concept: faq: "removing-list-arithmetic-operators-v0.11": page: _
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: Removing list arithmetic operators in CUE v0.11
authors: [jpluscplusm]
toc_hide: true
---

In early versions, the CUE language explicitly allowed arithmetic operators
("`+`" and "`*`") to take list arguments.
This feature was removed from the language specification
[several years ago](https://review.gerrithub.io/plugins/gitiles/cue-lang/cue/+/172f0060cd405f30c5873b793e44300e1a3588cb%5E%21/),
and its removal is now being completed in CUE version `v0.11`.
This FAQ answers some of your questions about what's changed.

## What's being removed, and from where?

TODO(jcm): The operators `*` and `+` when used with list arguments will stop
working with the CUE evaluator in the `cue` command, and the CUE Go API.

## Why were list arithmetic operators supported until now?

TODO(jcm): Because folks might have had CUE that used this syntax, but enough
time has now passed without it being mentioned on cuelang.org or the CUE
language spec that we can assume it's not being used by anyone.

## What's the replacement for list arithmetic operators?

TODO(jcm): list.Repeat(), list.Concat(), and nested for loops. Show examples.

## Which version of CUE removes list arithmetic operators?

TODO(jcm): any version that starts `v0.11`.

## Am I affected?

TODO(jcm): probably not. FIXME: how to check?

## I *am* affected! How can I fix my CUE?

TODO(jcm): `cue fix` examples. Manual fixup examples.

0 comments on commit ee797d4

Please sign in to comment.