cue-lang / cue

The home of the CUE language! Validate and define text-based and dynamic configuration
https://cuelang.org
Apache License 2.0
5.09k stars 291 forks source link

Language specification: Missing definition of "Slice" #772

Open cueckoo opened 3 years ago

cueckoo commented 3 years ago

Originally opened by @jansorg in https://github.com/cuelang/cue/issues/772

What did you expect to see?

The definition of "Slice" at https://cuelang.org/docs/references/spec/#primary-expressions

What did you see instead?

The other references elements (Selector, Index, Arguments) are defined, but the definition of Slices isn't included in the language specifiction.

cueckoo commented 3 years ago

Original reply by @mpvl in https://github.com/cuelang/cue/issues/772#issuecomment-779762917

Yes, slices were once supported, but were removed from the language spec as their semantics was complicated and not desirable. At some point during the query design we realized there is a reasonable chance they will be added back. So rather than letting people go to the migration off of slices, we decided to hold off on that. But that means slices are somewhat in limbo as of now.

There is a good chance the will be back in some form. However, CUE allows for some interesting alternatives that may end up being considerably more readable than approaches from other languages, so no guarantee yet.

Either way, whatever we decide, there will be a transition where slices are automatically converted to another syntax if we decide to move to something else. For now it probably makes sense to support it in syntax highlighting.

mpvl commented 1 week ago

Brief update on slices:

We are still quite undecided about this one.

So the idea is to keep slices around as they are for now, but knowing that the semantics and syntax will very likely change. We will not remove it until support for a good alternative is available.