cuelang / cue

CUE has moved to https://github.com/cue-lang/cue
https://cuelang.org
Apache License 2.0
3.09k stars 171 forks source link

documentation: Modify the confusing tour/references/aliases page #948

Closed PierreR closed 3 years ago

PierreR commented 3 years ago

Documentation of aliases & let

The following page of the doc refering to aliases is using the let construct: https://cuelang.org/docs/tutorials/tour/references/aliases/

But to be honest I am not sure if the page is meant to introduce the concept of aliases or the let construct. These two are treated in the spec.md as two different concepts (with different use cases).

Describe the solution you'd like

I suggest to align the page with the spec.md to avoid confusion.

To the best of my knowledge a more idiomatic way to write the code snippet of the aliases page would be:

A=a: {
    d: 3
}
b: {
    a: {
        // A provides access to the outer "a" which would
        // otherwise be hidden by the inner one.
        c: A.d
    }
}
mpvl commented 3 years ago

This is an artifact of the time when there was no let and the same syntax/terminology was used to describe both.

This is indeed very misleading and should be fixed.

cueckoo commented 3 years ago

This issue has been migrated to https://github.com/cue-lang/cue/issues/948.

For more details about CUE's migration to a new home, please see https://github.com/cue-lang/cue/issues/1078.