dsimcha <dsim...@yahoo.com> wrote:
I've been hacking in Phobos and parallelfuture and I've come to the
conclusion
that having typeof(c) in the expression foreach(c; string.init) not be a
dchar
is simply ridiculous. I don't care how much existing code gets broken,
this
needs to be fixed. Otherwise, all generic code will have to deal with
it as a
special case.
The other alternative, as has been proposed, is to create (d|w)?string
structs that are thin wrappers on top of immutable((d|w)?char)[].
Something along the lines of
struct string {
immutable(ubyte)[] payload;
alias payload this;
// Implement range primitives here.
}
should work, though it is nowhere near as elegant as what we have, and
would probably break some code.
Do note that I used ubyte instead of char as the element type, seeing
as how char/wchar would be unnecessary in this case.
This said, I am more in favor of changing the compiler than the strings.
--
Simen