Skip to content

spec: apparent contradiction for passing of slice argument to variadic parameter #30769

@myitcv

Description

@myitcv
Version of November 16, 2018

Section "Passing arguments to ... parameters" says:

If the final argument is assignable to a slice type []T, it may be passed unchanged as the value for a ...T parameter if the argument is followed by .... In this case no new slice is created.

Notice the use of the word "may". This appears to contradict what I understand to be the case in practice (i.e. that it will be passed unchanged, for reasons of efficiency) but also the example that follows:

... who will have the same value as s with the same underlying array.

Notice the use of the word "will".

cc @griesemer

FYI @mvdan @rogpeppe

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions