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.
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
codeUnitsgetter (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
[]andcountmethods, it just wouldn't explicitly inherit Iterable.