Top 5
Benji Smith
dlanguage at benjismith.net
Wed Oct 8 18:25:15 PDT 2008
Chris R. Miller wrote:
> Benji Smith wrote:
>> 4. String processing sucks. Writing code that works transparently with
>> all three character types and correctly handles all unicode characters
>> is basically impossible. Or at least it feels impossible. Trying to
>> support both Phobos and Tango in the same string-processing routine is
>> a definite no-go. In an ideal world, string-processing code shouldn't
>> have to be littered with "static if" all over the place.
>
> How would this be "fixed?" Hint: don't suggest making strings an
> object. We tried that a while back, and it was more or less shot down.
Well, personally, I'd prefer it if strings were objects.
But I could accept strings as character arrays if they were actually
characters arrays.
The current state of affairs, where strings are transparently just
arrays of UTF-8 bytes makes them impossible to work with. They're
unindexable, unsliceable. You can't operate directly on those arrays.
You're forced to use the phobos/tango functions (which, by the way, are
incompatible with one another).
If D strings must be character arrays, I'd love for them to at least be
ordinary arrays. Each element of a char[] array should be a single
character. And if a sizeof(char) == 1, then a char should be limited to
a single byte. To represent mutlibyte characters, it should be necessary
to use a wchar[] or dchar[] array.
--benji
More information about the Digitalmars-d
mailing list