Shouldn't hasSwappableElements work on char arrays?
Jonathan M Davis
jmdavisProg at gmx.com
Thu Feb 24 15:57:16 PST 2011
On Thursday, February 24, 2011 14:55:34 bearophile wrote:
> Jonathan M Davis:
> > Honestly, I think that the need for actual ASCII strings is quite rare
> > and that it _should_ not be encouraged.
>
> I need ASCII strings (or mutable/immutable arrays of ASCII chars) all the
> time, they come from English text, genomic data, etc.
And I would strongly argue that you shouldn't be using ASCII for text unless you
_need_ to. Unicode does the job just fine and doesn't run into problems when you
end up having to have non-ASCII characters. Far, far too many programs have been
written with the assumption that ASCII was good enough and then had to be
altered to work with unicode later. Using pure ASCII should be an optimization
and only done if it's necessary.
For something like genomic data, there's a good chance that such an optimization
would be necessary because you needed a random-access range and you risk using
too much memory using dstrings (and you know that all of the characters are
valid chars, because they're limited to the few characters used to hold genomic
data). But most people aren't dealing with genomic data. They're usually dealing
with text, and text should be unicode. Assuming that all you're ever going to
need is ASCII characters is generally unwise when dealing with text.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list