What's left for 1.0? - string class

Aarti_pl aarti at interia.pl
Fri Nov 17 04:38:16 PST 2006


Bill Baxter napisał(a):
> Samuel MV wrote:
>> This is *very* serious for i18n:
>>
>>  >>         char[] foo = "hög";
>>  >>         assert(foo.length == 3); // Sorry UTF-8, this is == 4
>>  >>         assert(foo[1] == 'ö');   // Not a chance!
>>
>> char[] should be a real char[], not a sort of byte[] for text. It 
>> needs to be fix for non-english.
> 
> That's what wchar and dchar are for.  If all you want is to make sure 
> your chars are chars, then use dchar everywhere and be happy.  Just be 
> aware that dchars are 32bits a piece.  Not a big deal for most apps, but 
> could be for a few.
> 
> Is there any problem with dchar other than just the size of it being 
> massive overkill for western languages?
> 
> --bb

from my point of view currently char is just an "alias" for ubyte, and 
could/should be removed because it is superfluous. You can not make even
char letter="ą"; // polish character a + ,

and in current state it is confusing... Maybe only dchar should be left 
and dchar should be renamed to char?...

But ok. I can live with char... But I think good string class is really 
necessary in all cases...

Regards
Marcin Kuszczak



More information about the Digitalmars-d mailing list