Skip to content

x/tour: minor confusion of array and slice length #79419

Description

@SebAlbert

The page about automatic slice ends at https://go.dev/tour/moretypes/10 reads (emphasis mine):

The default is zero for the low bound and the length of the slice for the high bound.

This is a bit confusing because up to that point, slices have always been generated from arrays, not slices. My first thought was "oh, you mean the length of the array for the high bound", which is indeed conformant to the example in the text. But in the code example on the right, slicing from a slice is introduced, so the full meaning is probably something along the lines of "length of the underlying array or slice".

As the result of slicing is also a slice, the term "length of the slice" could further be mistaken (in confusion) to mean the length of the resulting slice (however that might work), that's why I'd suggest adding the word "underlying".

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions