This repository has been archived by the owner on Nov 18, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc/ref/spec.md: get rid of list operators
List operators are confusing. For instance, is the result of [a, ...] + [b, ...] open or close? What about [a] + [b, ...]? And so on. With the current semantics of comprehensions, they are also unnecessary. The above can be written as [ for x in a {x}, for x in b {x} ]. Though more verbose, it is very clear here that regardless of whether a and b are open or closed the result is always closed. With the query extension, this can also be written more succinctly, like `[ a.[_], b.[_] ]` or perhaps `[a.*, b.*]`, either case is clearer than using list operators. See Issue #165. In order to move to being able to give backwards compatiblity guarantees, we propose getting rid of list addition and multiplication. An automatic rewriter could rewrite the old use using `list.Repeat` and `list.Concat`, the latter of which could refer to the spec to indicate its equivalence to using comprehensions or, later, queries. Change-Id: I374bfd59775d66d3da9feb28e1940f8bd3c255e8 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8063 Reviewed-by: CUE cueckoo <[email protected]> Reviewed-by: Paul Jolly <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]>
- Loading branch information