Why foreach(c; someString) must yield dchar

Kagamin spam at here.lot
Fri Aug 20 11:18:42 PDT 2010


Jonathan M Davis Wrote:

> Everywhere in the code where you currently have string, you'd have 
> String(immutable char) instead of immutable (char)[].

Not necessarily. I think, you can leave std.algorithm string-agnostic and special case string operations in, say, std.string, which will take and return regular string types, but internally call std.algorithms on dchar range wrappers, this is what std.algorithm does now, I suppose.

> Fundamentally, we're trying to treat something as two 
> different things without treating it as two different things. We want to treat it 
> as a range of characters and an array of unicode code units at the same time, 
> using it as a range of characters where appropriate and using it as an array of 
> code units where appropriate without having to special case it. I just don't 
> think that that's going to work.

I think we just want to do string operations. I believe, java and .Net live fine with String classes and string operations built into them.


More information about the Digitalmars-d mailing list