Skip to content

String should probably *not* be Iterable #32

@munificent

Description

@munificent

Right now, String itself implements Iterable and walks over the characters. (Once some real encoding support is in, that will probably be codepoints or code units.)

That doesn't play nice with iterable methods that flatten: recursively flatten a list of lists of strings and you'd get a giant list of characters.

Instead, it probably makes more sense for String to have a codeUnits getter (or whatever) that returns an iterable sequence of characters. That also makes it more explicit what you're iterating over.

String would still keep the [] and count methods, it just wouldn't explicitly inherit Iterable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions