On 05/30/2016 07:58 AM, Marc Schütz wrote:
On Saturday, 28 May 2016 at 12:04:20 UTC, Andrei Alexandrescu wrote:
On 5/28/16 6:59 AM, Marc Schütz wrote:
The fundamental problem is choosing one of those possibilities over the
others without knowing what the user actually wants, which is what both
BEFORE and AFTER do.
OK, that's a fair argument, thanks. So it seems there should be no
"default" way to iterate a string, and furthermore iterating for each
constituent of a string should be fairly rare. Strings and substrings
yes, but not individual points/units/graphemes unless expressly asked.
(Indeed some languages treat strings as first-class entities and
individual characters are mere short substrings.)
So it harkens back to the original mistake: strings should NOT be
arrays with the respective primitives.
I think this is going too far. It's sufficient if they (= char slices,
not ranges) can't be iterated over directly, i.e. aren't input ranges
(and maybe don't work with foreach).
That's... what I said. -- Andrei