Higher level built-in strings

Steven Schveighoffer schveiguy at yahoo.com
Tue Jul 20 12:31:57 PDT 2010


On Tue, 20 Jul 2010 15:21:34 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> Steven Schveighoffer wrote:
>> The omission of dchar is on purpose.  Phobos has characterized string  
>> as a bidirectional range of dchars.  For every range where I do:
>>  foreach(e; range)
>>  e is of the type of the range.  Except for char and wchar.  This  
>> schizophrenia of type induction is very bad for D, and it's a good  
>> argument of why strings should not simply be arrays.
>
> For many algorithms on strings, iterating by char is preferred over  
> dchar, even for multibyte strings.

Huh?  Which ones?  AFAIK, all of std.algorithm treats strings as ranges of  
dchar.

I am 100% in agreement with you that indexing and length should be done by  
char.  All I'm talking about is foreach.

-Steve


More information about the Digitalmars-d mailing list