Skip to content

Add slice/slice-assignment operators. #8977

Closed
@lrhn

Description

@lrhn

A lot of library operations on strings and lists would be more easily expressed using a Python (etc.) like "slice operator".

 T operator [:]({int start, int end});
 void operator[:]=(var value, {int start, int end});

This would replace String.substring with [:], make it easy to add List.subList/replace List.getRange with [:], use [:]= to replace insertRange.

Both parameters are optional, and usually default to start = 0 and end = length of sequence if omitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).closed-duplicateClosed in favor of an existing reporttype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions