Skip to content

proposal: spec: allow range over arbitrary types #13027

@ibnesayeed

Description

@ibnesayeed

Slice is a powerful and commonly used data structure in Go to organize multiple items in a sequence, but there are cases where List is a better choice. One such case could be where the number of items is large and arbitrary items are inserted one by one while maintaining certain sort order. Insertion or deletion at arbitrary places in a Slice would cause relocation of the trailing items.

For this reason if one chooses to use List over Slice, it comes with a cost of not being able to use Range iterator syntax. Consequently, the List is not supported by the template iterator system ({{range pipeline}}) either.

Hence, I am proposing the addition of Range iterator support for List data structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions