std.string will get the boot
Lionello Lunesu
lio at lunesu.remove.com
Sat Jan 30 19:06:06 PST 2010
On 30-1-2010 1:59, Andrei Alexandrescu wrote:
> bearophile wrote:
>> Andrei Alexandrescu:
>>> Currently arrays of characters count as random-access ranges, which
>>> is not true for arrays of char and wchar. I plan to make std.range
>>> aware of that and only characterize char[] and wchar[] (and their
>>> qualified versions) as bidirectional ranges.
>>
>> 32 bits are not enough to represent certain "characters", they need
>> more than one of such dchar. So dchar too may be a bidirectional range.
>
> [citation needed]
I also doubt 32-bit is not enough. In fact, Unicode has 0x10FFFF
as the highest code point.
>> Sometimes I have ugly 7-bit ASCII strings, I am not sure I want to be
>> forced to use cast(ubyte[]) every time I use an algorithm on them :-)
>
> That's exactly one of the cases in which my change would help. char is
> UTF-8, so that's out as an option for expressing ASCII characters.
> You'll be able to define your own type:
>
> struct AsciiChar {
> ubyte datum;
> ...
> }
>
> Then express stuff in terms of AsciiChar[] etc.
I miss typedef. I think this is exactly what typedef was intended
for. Perhaps we can reintroduce it as a 'short hand' for such a
struct?
By the way, ASCII is a subset of UTF-8 (that was the whole
point), so there's no reason why 'char[]' can't still be used for
ASCII strings, right?
L.
More information about the Digitalmars-d
mailing list