Fixing std.string

Jonathan M Davis jmdavisprog at gmail.com
Fri Aug 20 02:15:10 PDT 2010


On Thursday 19 August 2010 23:27:33 Russel Winder wrote:
> On Fri, 2010-08-20 at 02:22 +0000, dsimcha wrote:
> [ . . . ]
> 
> > 1.  How did it get to be this way?  Why did it seem like a good idea at
> > the time to only support UTF-8 and only immutable strings?
> 
> But isn't the thinking these days that immutable strings are a good
> thing?
> 
> Immutability is generally a good thing for all parallel, and indeed
> concurrent, computations.

Oh, the immutability can definitely be a good thing. That's why string is 
immutable(char)[]. However, forcing people to use string instead of the other 
possible string types is unnecessarily restrictive. There are cases where you 
can't use immutable stuff or where it's inefficient to do so. By making std.string 
handle all of the various string types as much as possible, it makes it much 
more flexible. But since string, wstring, and dstring are all immutable, most 
string processing will likely be on immutable. It's just that you won't be 
forced to do it that way if you want to take advatage of std.string.

- Jonathan m Davis


More information about the Digitalmars-d mailing list