string types: const(char)[] and cstring

Regan Heath regan at netmail.co.nz
Sun May 27 08:36:31 PDT 2007


renoX Wrote:
> I agree with you, I don't think that the string should be a char[] 
> alias, wether it's const or not but a class with char[],dchar[],wchar[] 
> under the hood representation and safe slicing by default.
> 
> The difficulty is providing enough flexibility for managing correctly 
> the internal representation: there should be a possibility to say use 
> UTF8 even though there are multibyte characters for example (a size 
> optimization with some CPU cost).

I think the class you describe would be useful, but only for certain types of application.  Many applications (those that deal with ASCII or only one of UTF8, 16 or 32 for example) wont need the sorts of things this class provides and can get away with just using 'const(char[])' AKA 'string'.  Basically I think there is a ample room for both 'string' as an alias and 'String' as a class to exist at the same time.

Regan



More information about the Digitalmars-d-announce mailing list